2

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.

I also checked the php.ini file, but there isn't any error log. I cannot find directory named var/log/apache or var/log/php.

I'm trying to log the errors into a file, without showing it in the browser.

The problem:

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

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

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Citra45Abadi
  • 207
  • 1
  • 6
  • 21
  • 5
    Possible duplicate of [Find out the error\_log's path](http://stackoverflow.com/questions/8955411/find-out-the-error-logs-path) – chris85 Apr 10 '17 at 02:29
  • The canonical is *[Where does PHP store the error log? (PHP 5, Apache, FastCGI, and cPanel)](https://stackoverflow.com/questions/5127838/)* (despite the over-specific title). – Peter Mortensen Sep 26 '21 at 13:52

2 Answers2

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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
vpdeva
  • 303
  • 2
  • 11
0

You should have written ini_set('error_log','/var/log/php/error.log') not ini_set('log_errors', '/var/log/php/error.log')