where is the error_log file?

时间:2017-04-10 02:18:47

标签: php error-log

I already set

//don't display errors
ini_set('display_errors', 0);
//write errors to log
ini_set('log_errors', 1);
//error log file name
ini_set('log_errors', '/var/log/php/error.log');

but I cannot find the log file.

also checked the php.ini but there is no error log. I cannot find directory named var/log/apache or var/log/php

What I'm trying to do is Log the errors into a file, without showing it on browser

the problem :

  1. I don't see /var/log/ directory, instead I found /php/logs/ directory

  2. I cannot log the errors without showing it on browser, even after I use ini_set() function

2 个答案:

答案 0 :(得分:1)

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

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(); ?>

答案 1 :(得分:1)

Try

\xampp\apache\logs\error.log

where xampp is your installation folder

If you haven't changed the error_log setting in PHP (check with phpinfo()), it will be logged to the Apache log.