According to the previous article "2015 Blog Upgrade (v): CentOS 7.1 Compilation Installation PHP7" of the configure
compilation parameters set, the installation of the PHP7 configuration file where the path is /usr/local/php7/etc
. The directory will have two profiles: php-fpm.conf
and php.ini
, as well as a folder php-fpm.d
(containing www.conf
files).
Therefore, this article mainly on the three PHP configuration files for a brief explanation, the specific configuration process is shown at the end of this article 附录
.
1 Configuring PHP.ini
PHP.ini is the PHP running core configuration file:
######避免PHP信息暴露在http头中expose_php = Off######避免暴露php调用mysql的错误信息display_errors = Off######在关闭display_errors后开启PHP错误日志(路径在php-fpm.conf中配置)log_errors = On######设置PHP的扩展库路径extension_dir = "/usr/local/php7/lib/php/extensions/no-debug-non-zts-20141001/"######设置PHP的opcache和mysql动态库zend_extension=opcache.soextension=mysqli.soextension=pdo_mysql.so######设置PHP的时区date.timezone = PRC######开启opcache[opcache]; Determines if Zend OPCache is enabledopcache.enable=1######设置PHP脚本允许访问的目录(需要根据实际情况配置);open_basedir = /usr/share/nginx/html;
2 Configuring Php-fpm.conf
Php-fpm.conf is php-fpm
the configuration file for the process service:
######设置错误日志的路径error_log = /var/log/php-fpm/error.log######引入www.conf文件中的配置include=/usr/local/php7/etc/php-fpm.d/*.conf
3 Configuring Www.conf (in the PHP-FPM.D directory)
Www.conf This is the php-fpm
extended configuration file for process services:
##### #设置用户和用户组user = Nginxgroup = Nginx###### According to the configuration Fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock in nginx.conf, set up PHP monitoring; Listen = 127.0. 0.1:9000 #### #不建议使用listen = /var/run/ Php-fpm/php-fpm.sock##### #开启慢日志slowlog = /var/log/php-fpm/$pool-slow.logrequest_slowlog_timeout = 10s ##### #设置php的session目录 (both users and user groups are Nginx) Php_value[session.save_handler] = Filesphp_ Value[session.save_path] = /var/lib/php/session
4 Appendices
In the previous "2015 Blog Upgrade (VI): Nginx configuration HTTPS and Spdy actual combat" and "CentOS system MySQL configuration file my.cnf" has been explained that this is about Nginx, All MySQL and PHP configurations are hosted on GitHub and Coding.net, with the following addresses:
GitHub address: HTTPS://GITHUB.COM/VFHKY/MYLNMP;
Coding Address: Https://coding.net/u/vfhky/p/mylnmp/git.
Finally, attached to the project:
Ext.: http://www.tuicool.com/articles/NjmQNj6
Configuration of PHP.ini, PHP-FPM, and www.conf in PHP7 (RPM)