1. 程式人生 > >快速定位PHP的配置檔案php.ini

快速定位PHP的配置檔案php.ini

因php存在cli和php-fpm兩種模式,因此兩種執行模式會對應載入不同的配置檔案。

php-fpm模式

在頁面中列印phpinfo(),通過瀏覽器訪問,在頁面中搜索php.ini
找到Configuration File (php.ini) Path 這一項即可

快速定位PHP的配置檔案php.ini

cli模式

方法1:通過php -i(PHP information) 在php資訊中搜索php.ini。(這裡同php-fpm模式中的phpinfo())

$ php -i|grep php.ini
Configuration File (php.ini) Path => /etc/php/7.3/cli
Loaded Configuration File => /etc/php/7.3/cli/php.ini

方法2:通過php --ini( Show configuration file names),顯示所有配置檔名稱

$ php --ini
Configuration File (php.ini) Path: /etc/php/7.3/cli
Loaded Configuration File:         /etc/php/7.3/cli/php.ini
Scan for additional .ini files in: /etc/php/7.3/cli/conf.d
Additional .ini files parsed:      /etc/php/7.3/cli/conf.d/10-mysqlnd.ini,
/etc/php/7.3/cli/conf.d/10-opcache.ini,
/etc/php/7.3/cli/conf.d/10-pdo.ini,
/etc/php/7.3/cli/conf.d/15-xml.ini,
/etc/php/7.3/cli/conf.d/20-amqp.ini,
/etc/php/7.3/cli/conf.d/20-apcu.ini,
/etc/php/7.3/cli/conf.d/20-calendar.ini,
/etc/php/7.3/cli/conf.d/20-ctype.ini,
/etc/php/7.3/cli/conf.d/20-curl.ini,
/etc/php/7.3/cli/conf.d/20-dom.ini,
/etc/php/7.3/cli/conf.d/20-exif.ini,
/etc/php/7.3/cli/conf.d/20-fileinfo.ini,
/etc/php/7.3/cli/conf.d/20-ftp.ini,
/etc/php/7.3/cli/conf.d/20-gearman.ini,
/etc/php/7.3/cli/conf.d/20-gettext.ini,
/etc/php/7.3/cli/conf.d/20-iconv.ini,
/etc/php/7.3/cli/conf.d/20-igbinary.ini,
/etc/php/7.3/cli/conf.d/20-imagick.ini,
/etc/php/7.3/cli/conf.d/20-json.ini,
/etc/php/7.3/cli/conf.d/20-mbstring.ini,
/etc/php/7.3/cli/conf.d/20-mongodb.ini,
/etc/php/7.3/cli/conf.d/20-msgpack.ini,
/etc/php/7.3/cli/conf.d/20-mysqli.ini,
/etc/php/7.3/cli/conf.d/20-pdo_mysql.ini,
/etc/php/7.3/cli/conf.d/20-phar.ini,
/etc/php/7.3/cli/conf.d/20-posix.ini,
/etc/php/7.3/cli/conf.d/20-readline.ini,
/etc/php/7.3/cli/conf.d/20-redis.ini,
/etc/php/7.3/cli/conf.d/20-shmop.ini,
/etc/php/7.3/cli/conf.d/20-simplexml.ini,
/etc/php/7.3/cli/conf.d/20-sockets.ini,
/etc/php/7.3/cli/conf.d/20-ssh2.ini,
/etc/php/7.3/cli/conf.d/20-stomp.ini,
/etc/php/7.3/cli/conf.d/20-sysvmsg.ini,
/etc/php/7.3/cli/conf.d/20-sysvsem.ini,
/etc/php/7.3/cli/conf.d/20-sysvshm.ini,
/etc/php/7.3/cli/conf.d/20-tokenizer.ini,
/etc/php/7.3/cli/conf.d/20-wddx.ini,
/etc/php/7.3/cli/conf.d/20-xdebug.ini,
/etc/php/7.3/cli/conf.d/20-xmlreader.ini,
/etc/php/7.3/cli/conf.d/20-xmlwriter.ini,
/etc/php/7.3/cli/conf.d/20-xsl.ini,
/etc/php/7.3/cli/conf.d/20-yaml.ini,
/etc/php/7.3/cli/conf.d/25-apcu_bc.ini,
/etc/php/7.3/cli/conf.d/25-memcached.ini