Home | 簡體中文 | 繁體中文 | 雜文 | 打賞(Donations) | ITEYE 博客 | OSChina 博客 | Facebook | Linkedin | 知乎專欄 | Search | Email

1.2. php 命令

1.2.1. -c <path>|<file> Look for php.ini file in this directory

指定php.ini檔案

php -c /etc/php/cli/php.ini -f test.php
			

1.2.2. -d foo[=bar] Define INI entry foo with value 'bar'

php -d error_log=/tmp/php_errors.log -c /srv/php/etc/php-cli.ini synchronous.php restart			
			

1.2.3. --ini Show configuration file names

顯示配置檔案名

$ php --ini
Configuration File (php.ini) Path: /etc/php5/cli
Loaded Configuration File:         /etc/php5/cli/php.ini
Scan for additional .ini files in: /etc/php5/cli/conf.d
Additional .ini files parsed:      /etc/php5/cli/conf.d/05-opcache.ini,
/etc/php5/cli/conf.d/10-pdo.ini,
/etc/php5/cli/conf.d/20-curl.ini,
/etc/php5/cli/conf.d/20-json.ini,
/etc/php5/cli/conf.d/20-readline.ini

# php --ini
Configuration File (php.ini) Path: /srv/php-5.5.13/etc
Loaded Configuration File:         /srv/php-5.5.13/etc/php.ini
Scan for additional .ini files in: /srv/php-5.5.13/etc/conf.d
Additional .ini files parsed:      /srv/php-5.5.13/etc/conf.d/amqp.ini,
/srv/php-5.5.13/etc/conf.d/pthreads.ini,
/srv/php-5.5.13/etc/conf.d/redis.ini,
/srv/php-5.5.13/etc/conf.d/safenet.ini,
/srv/php-5.5.13/etc/conf.d/xdebug.ini
			

1.2.4. 配置掃瞄目錄

編譯PHP的時候可以通過 --with-config-file-scan-dir=來指定配置檔案掃瞄目錄。那麼我們怎樣再運行時修改這個目錄呢?

export PHP_INI_SCAN_DIR=/srv/php/etc/cli.d
export PHP_INI_SCAN_DIR=/srv/php/etc/conf.d:/srv/php/etc/fpm.d