2011-04-08 22:20
浏览 67


I config/make/make install php on a system where php is already installed:

 ./configure --prefix=/opt/php
 --with-config-file-path=/opt/php/etc --with-config-file-scan-dir=/opt/php/etc/php.d
 --enable-fpm --with-fpm-user=ec2-user --with-fpm-group=ec2-user --disable-debug 
 --enable-exif --with-curl --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-
 pdo-mysql=mysqlnd --with-zlib --enable-zip --enable-bcmath --enable-calendar 
 --enable-ftp --with-mhash --with-openssl --with-mcrypt --enable-mbstring --enable-
 mbregex --with-gd --with-jpeg-dir --with-png-dir

(all ok) however, when I type php --ini (inside /opt/php/bin) I get the old stuff:

> Configuration File (php.ini) Path:
> /etc Loaded Configuration File:       
> /etc/php.ini Scan for additional .ini
> files in: /etc/php.d Additional .ini
> files parsed:      /etc/php.d/apc.ini,
> /etc/php.d/curl.ini,
> /etc/php.d/fileinfo.ini,
> /etc/php.d/json.ini,
> /etc/php.d/mbstring.ini,
> /etc/php.d/phar.ini,

why / how can i fix this?

my bashrc:

if [ -d "/opt/php/bin"] && [ -d "/opt/php/sbin" ]; then PATH="$path:/opt/php/bin:/opt/php/bin"

my php-config looks ok:

Usage: ./php-config [OPTION]
  --prefix            [/opt/php]
  --includes          [-I/opt/php/include/php -I/opt/php/include/php/main -I/opt/php/include/php/TSRM -I/opt/php/include/php/Zend -I/opt/php/include/php/ext -I/opt/php/include/php/ext/date/lib]
  --ldflags           []
  --libs              [-lcrypt   -lz -lcrypt -lrt -lmcrypt -lltdl -lpng -lz -ljpeg -lcurl -lz -lrt -lm -ldl -lnsl  -lrt -lxml2 -lz -lm -lssl -lcrypto -ldl -lz -lcurl -lxml2 -lz -lm -lssl -lcrypto -ldl -lz -lxml2 -lz -lm -lcrypt -lxml2 -lz -lm -lxml2 -lz -lm -lxml2 -lz -lm -lcrypt ]
  --extension-dir     [/opt/php/lib/php/extensions/no-debug-non-zts-20090626]
  --include-dir       [/opt/php/include/php]
  --php-binary        [/opt/php/bin/php]
  --php-sapis         [cli fpm]
  --configure-options [--prefix=/opt/php --with-config-file-path=/opt/php/etc --with-config-file-scan-dir=/opt/php/etc/php.d --enable-fpm --with-fpm-user=ec2-user --with-fpm-group=ec2-user --disable-debug --enable-exif --with-curl --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-zlib --enable-zip --enable-bcmath --enable-calendar --enable-ftp --with-mhash --with-openssl --with-mcrypt --enable-mbstring --enable-mbregex --with-gd --with-jpeg-dir --with-png-dir]
  --version           [5.3.5]
  --vernum            [50305]

but... myphp.ini does not, it seems my --with-config-file-path=PATH (Sets the path in which to look for php.ini, defaults to PREFIX/lib.) somehow is not working?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

4条回答 默认 最新

  • dongqiongzheng0615
    dongqiongzheng0615 2011-04-09 07:51

    I now had 5.3.5. I wget-ed 5.3.6, configure, make, make install...

    and the .ini settings were ok.

    点赞 评论
  • douzhou7124
    douzhou7124 2011-04-08 22:34

    Try the command which -a to see which php executable is in the path.

    点赞 评论
  • dongque1462
    dongque1462 2011-06-22 19:32

    Here is what I did in a similar situation :

    Context: PHP loaded as an Apache module (eg DSO)

    HOW in short :
    shell ENV

    export PHP_INI_SCAN_DIR


    # ...
    # DSO Modules: PHP as an Apache module
    SetEnv PHPRC /usr/pathtophpini
    SetEnv PHP_INI_SCAN_DIR /usr/pathtophpini
    LoadModule php5_module /pathtophpmod/
    PHPINIDir /pathtophpini
    # ...


    /etc/init.d/apache2 restart   

    Then I can choose the php.ini file I want to get loaded at Apache start.

    点赞 评论
  • drrvnbwle80177811
    drrvnbwle80177811 2013-08-10 01:57

    In PHP request #45114, writes:

    I added 2 ways to do this. Now you can either use both -n and -c in command line options (-n disables every ini loading, -c enables loading the specified file / from specified path) or set PHP_INI_SCAN_DIR environment variable to empty (disables scanning) or to point to some other directory.


    php -n -c /conf -r'phpinfo();'


    Configuration File (php.ini) Path => /etc/php5/cli
    Loaded Configuration File => /conf/php.ini
    Scan this dir for additional .ini files => (none)
    Additional .ini files parsed => (none)
    点赞 评论