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 :
I don't see /var/log/
directory, instead I found /php/logs/
directory
I cannot log the errors without showing it on browser, even after I use ini_set()
function
答案 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.