Sunday, June 18, 2017

How to check PHP error log on Lubuntu?

How to check PHP error log on Lubuntu?

Quick question from one of my friend at work who just learn about php programming, he asked me about how to check error message in php? well, if you are not using any framework (just regular php), then the answer is in the web server error log.

Yup, if you just using regular php without any framework, then you can take a look at the web server error log, but if you are using framework then most likely the framework has it's own way of displaying error or even has it's own error log.

Anyway, if you are using apache web server the error log should be located on: 
/var/log/apache2/error.log

You can view it like this:
cat /var/log/apache2/error.log

If you want to view the error log contantly, you can run this:
tail -f /var/log/apache2/error.log
The command above will always open the apache error log, so when new error happens it will display immediately, to exit simply press CTRL + C.

FYI : you can edit the php.ini if you want to change the location of the apache error log.

2 comments: