php error log

OK so I set up php on Debian 7 following the Linux user guide which works perfectly except that no errors get written to the php error log. I have edited php.ini exactly as set out in the guide which is here: … linode-1gb">

and sets the following parameters:

maxexecutiontime = 30

memory_limit = 128M


display_errors = Off

log_errors = On

error_log = /var/log/php.log

register_globals = Off

I have restarted apache after entering these parameters. PHP works fine but I need to debug a script from the error log. There is no php.log file in the directory /var/log

As I have set up apache and php according to the guide, I'm surprised that the error log is not working. Any suggestions gratefully received.

4 Replies

Maybe you need to create the php.log file first manually and give write permissions to whoever PHP is running as.

It might not have permissions now to create a file in /var/log/

I personally create the directory /var/www/php and chown it to www-data and point the error logs to there. You can have one per FPM pool/Apache vhost

Thanks for the replies. I followed the advice of obs as follows:

1 edit php.ini to redirect logs to /var/www/php/php.log

2 restarted apache

3 chowned /var/www/php to www-data

4 triggered an error in php

This worked immediately so many thanks. I think maybe the guide should be amended to avoid this problem.

I've poked them to update it.


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct