Use logging with PHP's built-in web server

Write to the php built-in web server's log.

<?php
// index.php
error_log(json_encode($_GET), 4);
$ php -S 127.0.0.1:8000 index.php
$ curl -i "http://127.0.0.1:8000/?foo=bar"
HTTP/1.1 200 OK
Host: 127.0.0.1:8000
Connection: close
X-Powered-By: PHP/5.6.5
Content-type: text/html; charset=UTF-8
View this page on GitHub.
Posted .

Comments

Leave a Reply