PHP built-in server error log location

Bryan Estrito picture Bryan Estrito · Nov 25, 2014 · Viewed 26.9k times · Source

I don't know if there's any? but is php built in web server also save its error logs in a file? for tailing purposes, like when creating virtual host in apache.

UPDATE: i'm using mac osx

Answer

thenickdude picture thenickdude · Apr 12, 2016

The built-in webserver doesn't log anywhere by default, so you need to provide a php.ini for it to customise this. For example, if you created a file called php.ini with this content:

error_log = /Users/me/test.log
log_errors = on
date.timezone = UTC

Then you can start PHP's built-in webserver like this:

php -S 127.0.0.1:8080 -c php.ini

And error_log() calls will be logged to the file you've specified.