Where Does PHP Store the Error Log in a Shared Hosting Environment? (PHP 5, Apache, FastCGI, and cPanel)
When running PHP on a shared hosting server with cPanel, Apache, and FastCGI, locating the error log can be challenging. Here's a comprehensive guide to help you find the error log effectively:
Default Location:
- If PHP is running as an Apache module, the error logs are typically stored in /var/log/apache2.
Root Directory:
- Shared hosts often place log files in a subfolder named /log within the root directory of your website.
php.ini Configuration:
- If you have access to the php.ini file, you can specify a custom location for the error log. To do this, add the following line:
error_log = /var/log/php-scripts.log
Copy after login
cPanel Master Log:
- According to a comment by "rinogo," cPanel users can locate a master error log file (by default) at:
/usr/local/apache/logs/error_log
Copy after login
phpinfo() Function:
- If you have access to your PHP site, you can use the phpinfo() function to display information about the PHP installation, including the error log file location.
Additional Tips:
- If you are unable to find the error log in the default locations mentioned above, try searching your site structure for any files named "error_log" or "error_log.txt."
- Some hosting providers may offer additional logging options within their control panel or user interface. Check with your hosting provider for specific instructions on accessing error logs.
The above is the detailed content of Where Can I Find My PHP Error Log on a Shared cPanel Server?. For more information, please follow other related articles on the PHP Chinese website!