Home >Backend Development >PHP7 >How to configure php.ini, php-fpm and www.conf in PHP7
This article will introduce to you the configuration methods of "php.ini", "php-fpm" and "www.conf" in PHP7. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.
Therefore, this article mainly briefly explains these three PHP configuration files. For the specific configuration process, see the appendix at the end of this article.
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.so extension=mysqli.so extension=pdo_mysql.so ######设置PHP的时区 date.timezone = PRC ######开启opcache [opcache] ; Determines if Zend OPCache is enabled opcache.enable=1 ######设置PHP脚本允许访问的目录(需要根据实际情况配置) ;open_basedir = /usr/share/nginx/html;
php-fpm.conf is the configuration file of the php-fpm process service:
######设置错误日志的路径 error_log = /var/log/php-fpm/error.log ######引入www.conf文件中的配置 include=/usr/local/php7/etc/php-fpm.d/*.conf
www.conf This is the extended configuration file of the php-fpm process service:
######设置用户和用户组 user = nginx group = nginx ######根据nginx.conf中的配置fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;设置PHP监听 ; listen = 127.0.0.1:9000 #####不建议使用 listen = /var/run/php-fpm/php-fpm.sock ######开启慢日志 slowlog = /var/log/php-fpm/$pool-slow.log request_slowlog_timeout = 10s ######设置php的session目录(所属用户和用户组都是nginx) php_value[session.save_handler] = files php_value[session.save_path] = /var/lib/php/session
Finally, attach a screenshot of the project:
Recommended learning: php video tutorial
The above is the detailed content of How to configure php.ini, php-fpm and www.conf in PHP7. For more information, please follow other related articles on the PHP Chinese website!