Locating PHP Error Logs When Using PHP 5, Apache, FastCGI, and cPanel
In a shared hosting environment where PHP is operated by FastCGI with cPanel and Apache, the default location for PHP error logs is /var/log/apache2, assuming PHP is an Apache module.
Alternatively, shared hosting providers often store log files in a subfolder named /log in the root directory. However, if you have access to the php.ini file, you can specify a custom error log location by setting the "error_log" directive.
To check the current error log location, navigate to your php.ini file and look for the following line:
error_log = /var/log/php-scripts.log
Another possible location for the error log is /usr/local/apache/logs/error_log, as mentioned by rinogo in a comment.
If these methods do not yield the desired results, you can use the phpinfo() function to determine the error log location:
<?php phpinfo(); ?>
By searching the page output for "error_log," you should be able to identify the path to the error log file.
The above is the detailed content of Where Are My PHP Error Logs in a cPanel/Apache/FastCGI Environment?. For more information, please follow other related articles on the PHP Chinese website!