Home  >  Article  >  Backend Development  >  What to do if php error log does not take effect

What to do if php error log does not take effect

藏色散人
藏色散人Original
2021-07-16 11:06:142368browse

The solution to the problem that the php error log does not take effect: first edit "/etc/php-fpm.d/www.conf"; then restart "php-fpm"; finally call "error_log()".

What to do if php error log does not take effect

The operating environment of this article: Windows7 system, PHP7.1 version, DELL G3 computer

What should I do if the php error log does not take effect?

Remember a pitfall where PHP error_log output log does not take effect

At first I wanted to use error_log() to output logs in the project, and enable the following configuration in php.ini:

log_errors = On
error_log = /mnt/hgfs/workspace/php-error.log

Then use error_log() to print the log in the project and find that php-error.log has no content

Use phpinfo() to view the configuration

What to do if php error log does not take effect

Found that the configuration in php.ini did not take effect. Edit /etc/php-fpm.d/www.conf

What to do if php error log does not take effect

Comment out these two lines and restart php-fpm. , check again that phpinfo

What to do if php error log does not take effect

# has become the value we configured, call error_log() again, and find that it can be correctly output to the file, because php_admin_value will overwrite the value in php.ini value.

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of What to do if php error log does not take effect. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn