PHP cannot write to error log - permission denied

In my first PHP script for many years, I am trying to register an error:

error_log("my error message", 3, $error_log);

I get an error in the general Apache error log:

PHP Warning: error_log (/var/log/apache2/my_php_errors.log): Could not open stream: permission denied in / var / www / html / blahblah / my _script.php on line 88

This is what I checked and tried:

  • Created $error_logwith the same ownership ( root.adm) and permissions ( 640) as the Apache error log.
  • Changed the owner www-data, which is a PHP user running as.
  • log_errors On.
  • open_basedir not installed.
  • Using PHP 5.5.x, so safe mode does not exist.

What am I missing?

: Apache. , .

2: , WAMP, - LAMP .

+7
1

. https://serverfault.com/questions/831444/php-error-log-per-vhost/831666#831666

touch /path/to/php_error.log
chown www-data:www-data php_error.log
chmod 755 php_error.log

, !

+1

All Articles