Where are PHP logs stored?

Better Stack Team
Updated on November 23, 2022

PHP stores error logs in /var/log/apache2 if PHP is an apache2 module. Shared hosts are often storing log files in your root directory /log subdirectory. If you are using cPanel, the master log is stored in /usr/local/apache/logs/error_log.

You can change the log file location in the php.ini configuration file:

 
error_log = /var/log/php-scripts.log

You can check the PHP configuration at any time by running the following PHP code:

 
<?php phpinfo(); ?>