1

I have had no problems with separate php_error logs per vhosts in the past.

I have recently installed a server with Ubuntu 16.04, using php7 on apache2.

my vhost reads:

<VirtualHost *:80>
    ServerName examp.com
    Header always unset X-Frame-Options
    DocumentRoot /var/www/sos/rtg/html
    ErrorLog /var/www/sos/rtg/error.log
    CustomLog /var/www/sos/rtg/access.log combined
    php_flag log_errors on
    php_flag display_errors on
    php_value error_reporting 2147483647
    php_value error_log /var/www/sos/rtg/php_error.log
    php_admin_value error_log "/var/www/sos/rtg/php_error.log"
</VirtualHost>

Based on internet recommendations, I have touch 'ed php_error.log and adjusted privileges. chown and chmod all different possibilities. I cannot seem to get php to write to an error log other than apache's error.log

I have had this working in all other servers I have (albeit ubuntu 14, apache2 and php5)

  • But what is your question? What problem do you have? Do not touch any file, let Apache create them as needed. Make sure that all /var, /var/www, /var/www/sos are readable+executable for the user under which Apache runs, and that /var/www/sos/rtg/ is readable+executable+writable for the same user, in order for it to be able to create files in it. – Patrick Mevzek Feb 9 '17 at 0:09
  • I did the touch on the advise of another website. I normalized that trial. Apache creates error.log and access.log in the directory fine. I do know that the php_flag display_errors on is working, because if I comment that, it doe not display on screen errors... – James Bailey Feb 9 '17 at 2:25
1
touch /path/to/php_error.log
chown www-data:www-data php_error.log
chmod 755 php_error.log

https://stackoverflow.com/questions/35731760/php-cant-write-to-error-log-permission-denied

led me to the answer

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.