Home >Backend Development >PHP Tutorial >Where Do PHP Error Logs Go in a Shared cPanel Hosting Environment?
Locating PHP Error Logs in a Shared Hosting Environment with Apache, FastCGI, and cPanel
On a shared hosting server running PHP version 5.2.16 with Apache, FastCGI, and cPanel, the location of PHP error logs can be elusive.
Where PHP Stores Error Logs
By default, Apache on Linux typically stores error logs in /var/log/apache2. If PHP is running as an Apache module, the error logs will be located there as well.
Shared Hosting Log Locations
Shared hosts often store log files in a subfolder within the server's root directory, such as /log. It's worth checking this location for error_log files.
Customizing the Error Log Path with php.ini
If you have access to the php.ini file, you can manually specify the path to the error log. To do this, add the following line to the file:
error_log = /var/log/php-scripts.log
Accessing the Master Log File with cPanel
According to the comment by rinogo, cPanel users can find the master error log file at /usr/local/apache/logs/error_log by default.
Checking the Log File Location with PHP
As a last resort, you can use PHP to determine the current log file location:
<?php phpinfo(); ?>
This code will output a page with various PHP configuration information, including the path to the error log.
The above is the detailed content of Where Do PHP Error Logs Go in a Shared cPanel Hosting Environment?. For more information, please follow other related articles on the PHP Chinese website!