PHP built-in server error log location

后端 未结 6 1419
长发绾君心
长发绾君心 2021-01-01 16:17

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.

UP

6条回答
  •  萌比男神i
    2021-01-01 16:17

    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.

提交回复
热议问题