在/usr/local/php/etc/目錄下新建php2.iniphp
複製php.ini 內容到php2.ini 或cp php.ini 也行。nginx
配置php-fpm 參數:bash
Usage: php [-n] [-e] [-h] [-i] [-m] [-v] [-t] [-p <prefix>] [-g <pid>] [-c <file>] [-d foo[=bar]] [-y <file>] [-D] [-F] -c <path>|<file> Look for php.ini file in this directory -n No php.ini file will be used -d foo[=bar] Define INI entry foo with value 'bar' -e Generate extended information for debugger/profiler -h This help -i PHP information -m Show compiled in modules -v Version number -p, --prefix <dir> Specify alternative prefix path to FastCGI process manager (default: /usr/local/php). -g, --pid <file> Specify the PID file location. -y, --fpm-config <file> Specify alternative path to FastCGI process manager config file. -t, --test Test FPM configuration and exit -D, --daemonize force to run in background, and ignore daemonize option from config file -F, --nodaemonize force to stay in foreground, and ignore daemonize option from config file -R, --allow-to-run-as-root Allow pool to run as root (disabled by default)
其中:-cphp-fpm
<path>|<file> Look for php.ini file in this directorythis
指定ini文件的目錄spa
因此:debug
php-fpm -c /usr/local/php/etc/php2.ini
重啓nginx是查看沒有改變!code
service nginx reload
要重啓php-fpmorm
可是提示:blog
ERROR: An another FPM instance seems to already listen on /tmp/php-cgi.sock
ERROR: FPM initialization failed
因此先中止php-fpm 服務在指定php.ini 文件
/etc/init.d/php-fpm stop
php-fpm -c /usr/local/php/etc/php2.ini
--------------------------------------------------------------------------------------------------------
隱藏X-Powered-By
則修改 php.ini 文件 設置 expose_php = Off
記得重啓是重啓php-fpm 而不是nginx,重啓php-fpm , 若是修改了php.ini配置目錄還要從新-c 配置ini目錄