I am using Nginx and PHP-FPM on Linux. I am not sure whether the issue is that PHP is not writing to the location specified in the PHP.ini, or if it just isn't working at all.

Some of the logs produced by Nginx and PHP-FPM contain the PHP errors, but they are mixed in with other Nginx log output. When I run phpInfo(), value in the error_log is set to a folder in my home directory, but nothing is ever created.

I understand that values in the Nginx conf and PHP-FPM conf can overwrite those set in the PHP.ini, but surely running phpInfo(), would show the final config values?

I would like to be able to have 1 folder, with seperate files for the Nginx access and error log as well as PHP errors.


2 Answers 2


The error directory is pointing to your home directory, but I believe nginx don't have the access to write to your home directory, unless you are running nginx with your username.

If you want to write to some specific directory, it should have access to write to that directory.

Try to change the location of the error directory and it should work.

  • I changed the location to /etc/nginx/phperrorlog2.log but still no luck. Tried creating a blank file myself as well, but again, no luck.
    – SteveEdson
    Dec 20, 2012 at 11:33
  • which user you are running your nginx from? You can find the same with this command ps aux | grep nginx
    – Napster_X
    Dec 20, 2012 at 12:00
  • This shows the processes and their users gist.github.com/85cee085222eda5006ab
    – SteveEdson
    Dec 20, 2012 at 13:17
  • So, you are running nginx with nginx user. Now try checking the user for the /etc/nginx directory with this command ls -ld /etc/nginx. If it's not nginx then set it to nginx with this command chown -R nginx.nginx /etc/nginx. Then restart the process and it should work.
    – Napster_X
    Dec 20, 2012 at 13:34
  • For the benefit of anyone else reading this - it's not the user runing nginx which matters - it's the user running PHP-FPM (see your fpm config). These might be the same user, they might not.
    – symcbean
    Dec 20, 2012 at 14:59

Make sure log_errors is set to On. And make sure the error_log file is writable by the user PHP is running as. (usually www-data)

Nothing else to it, really.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .