PHP Errors are not stored on CentOS Server

Solution 1:

From official documentation, you should change permission of /var/log/php-errors.log so the file is writable by apache user (e.g www, www-data, etc.)

#chown www:www 

error_log string

Name of the file where script errors should be logged. The file should be writable by the web server's user. If the special value syslog is used, the errors are sent to the system logger instead. On Unix, this means syslog(3) and on Windows NT it means the event log. The system logger is not supported on Windows 95. See also: syslog(). If this directive is not set, errors are sent to the SAPI error logger. For example, it is an error log in Apache or stderr in CLI. See also error_log().

Solution 2:

If you are having trouble writing/reading files you should review the exhaustive list in this answer: https://stackoverflow.com/questions/12531408/setting-php-tmp-dir-php-upload-not-working

Basically, if you want apache to write to a an error_log file other than syslog, apache needs to have permissions to write to it, and if the file does not yet exist apache needs write permissions on parent folder as well.

None of this applies if you are trying to read/write or set your error_log to the /tmp folder starting in CentOS 7 however. The answer here: https://stackoverflow.com/questions/10752396/cant-write-to-tmp-with-php-despite-777-permissions-and-no-open-basedir-value?rq=1 Referencing this blog http://blog.oddbit.com/2012/11/05/fedora-private-tmp/ explains how systemd does not allow it.

Solution 3:

Apparently I also needed display_errors = on . I thought this was for error display onscreen but it is for error logging as well it seems.