How to Enable PHP Error Log

In my article this time, I will discuss how to enable php error log. A little story, not long ago I had a case where I installed Laravel on a server using the LEMP base. After I installed it and ran it in the browser, nothing appeared and I checked the log in Nginx and there was no error whatsoever. Then when I want to check the php logs, there are no php logs. That’s because the php log has not been enabled in the www.conf file configuration. Once I activate it and I check the php logs, the main problem is only because of the laravel folder permissions: lol:.

Okay, we go straight to the topic of discussion, to activate the php log, here are the steps:

 

Step 1 – Update the php-fpm www.conf file

First, we edit / add the parameters in the www.conf file. we just go into the file. If we don’t know where it is, we can search it with the find command as follows:

find / -name 'www.conf'

then go straight to your favorite editor, for example:

vim /etc/php/7.3/fpm/pool.d/www.conf

next, edit / add these parameters:

php_flag[display_errors] = on
php_admin_value[error_log] = /var/log/fpm-php.www.log
php_admin_flag[log_errors] = on

 

Step 2 – Reload / restart the php-fpm service

After you finish updating the configuration file www.conf, all you have to do is restart the service

systemctl restart php-fpm

 

Step 3 – The log has been activated

The php log has been activated, you can access it in the file /var/log/fpm-php.www.log .

 

Yep, that’s the information I can share about how to enable php error log. Hopefully this information can be useful, Thank you 🙂

 

Also Read :
Lukems:

This website uses cookies.