EN VI

Php - Built-in web server floods syslog with request information?

2024-03-14 23:00:10
How to Php - Built-in web server floods syslog with request information

I'm running php 8.3 cli on a debian 12.5 server. The php process is spamming the debian syslog, with lots of access log for example:

Mar 14 14:19:38 *** php[***]: [Thu Mar 14 14:19:38 2024] ***:58391 Accepted
Mar 14 14:19:38 *** php[***]: [Thu Mar 14 14:19:38 2024] ***:58392 [200]: GET /***/***.php
Mar 14 14:19:38 *** php[***]: [Thu Mar 14 14:19:38 2024] ***:58392 Closing
Mar 14 14:19:45 *** php[***]: [Thu Mar 14 14:19:45 2024] ***:58401 Accepted
Mar 14 14:19:46 *** php[***]: [Thu Mar 14 14:19:46 2024] ***:58401 [200]: POST /***/***.php
Mar 14 14:19:46 *** php[***]: [Thu Mar 14 14:19:46 2024] ***:58401 Closing
Mar 14 14:19:46 *** php[***]: [Thu Mar 14 14:19:46 2024] ***:58403 Accepted
Mar 14 14:19:47 *** php[***]: [Thu Mar 14 14:19:47 2024] ***:58403 [200]: POST /***/***.php
Mar 14 14:19:47 *** php[***]: [Thu Mar 14 14:19:47 2024] ***:58403 Closing

No matter what configuration I did in the php.ini file (including disabling all error logs), will not stop the access log. The HTTP server is the one built-in PHP 8.3, no external webserver is used.

I found some configuration for it in OLD php versions, but they do not work for php 8.3

If anyone could help me disabling this output to the system logs, I would appreciate it.

Thank you.

Solution:

You could try redirecting the output of the PHP -S command to /dev/null if you don't care about it at all:

php -S 0.0.0.0:8181 &> /dev/null

Bear in mind, you should be using the PHP builtin service in production, it's only really intended for development purposes, you should use something like apache2 or nginx for your live server.

From the PHP docs

Warning
This web server is designed to aid application development. It may also be useful for testing purposes or for application demonstrations that are run in controlled environments. It is not intended to be a full-featured web server. It should not be used on a public network.
Answer

Login


Forgot Your Password?

Create Account


Lost your password? Please enter your email address. You will receive a link to create a new password.

Reset Password

Back to login