skip to Main Content

I have searched this for hours but haven’t found working solution yet.

I have this setting in my php.ini

error_log = error_log

It should make separate error_log file in every folder if I’m right ?

But it does not. I also have this in the beginning of my script :

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
ini_set('error_log', 'error_log');
error_reporting(E_ALL);

Still all my errors are logged in /var/log/apache2/error_log

How to make it to log errors in each folder where script is running ?

I’m running Ubuntu 1.04 with LAMP stack installed.
php version is 7.2

Thank you in advance

3

Answers


  1. Chosen as BEST ANSWER

    I found the problem. It was permission issue, I forgot to do chown and chmod for this folder. Thank you all.


  2. You can set relative paths with something like…

    error_log = ../logs/error_log_name

    So if your index.php file is in /var/www/mysite/public/index.php then the log file will be in /var/www/mysite/logs/error_log_name

    Login or Signup to reply.
  3. In my case, I just discovered I changed php versions in my CPanel’s MultiPHP manager from alt-php to ea-php. Reverting back to alt-php brought back the error_log files that had stopped working.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search