Where does PHP store the error log? (php5, apache,

2018-12-31 05:06发布

I am on shared hosting and have Cpanel, Apache, PHP is run by fastcgi. Where does PHP store the error log?

Is there any other way I can find the error log on shared hosting environment instead of having to go through entire site structure to look for error_log files?

I have access to the php.ini (I am using PHP version 5.2.16).

18条回答
若你有天会懂
2楼-- · 2018-12-31 05:30

On a LAMP environment the php errors are default directed to this below file.

/var/log/httpd/error_log

All access logs come under:

/var/log/httpd/access_log
查看更多
路过你的时光
3楼-- · 2018-12-31 05:31

Wordpress

Wordpress will direct error_log() messages to /wp-content/debug.log when WP_DEBUG_LOG is set to true.

See Wordpress Documentation for WP_DEBUG_LOG

查看更多
冷夜・残月
4楼-- · 2018-12-31 05:32

Search the httpd.conf file for ErrorLog by running cat <file location> | grep ErrorLog on the command line. For example:

$ cat /etc/apache2/httpd.conf | grep ErrorLog

Output:

# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
ErrorLog "/private/var/log/apache2/error_log"

Find the line that starts with ErrorLog and there's your answer.

Note: For virtual hosts, you can edit the virtual hosts file httpd-vhosts.conf to specify a different log file location.

查看更多
ら面具成の殇う
5楼-- · 2018-12-31 05:33

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 subfolder. But...if you have access to a php.ini file you can do this:

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

According to rinogo's comment: If you're using cPanel, the master log file you're probably looking for is stored (by default) at

/usr/local/apache/logs/error_log

If all else fails you can check the location of the log file using

<?php phpinfo(); ?>
查看更多
流年柔荑漫光年
6楼-- · 2018-12-31 05:35

When configuring your error log file in php.ini, you can use an absolute path or a relative path. A relative path will be resolved based on the location of the generating script, and you'll get a log file in each directory you have scripts in. If you want all your error messages to go to the same file, use an absolute path to the file.

See more here: http://www.php.net/manual/en/ref.errorfunc.php#53025

查看更多
路过你的时光
7楼-- · 2018-12-31 05:35

NGINX usually stores it in /var/log/nginx/error.log or access.log. (On Ubuntu in any case)

查看更多
登录 后发表回答