1. Home
  2. Technical
  3. SSH / Shell
  4. Detecting slow PHP requests
  1. Home
  2. Technical
  3. Detecting slow PHP requests

Detecting slow PHP requests

On the Zone server platform, the real-time web server logs are situated in the logs directory.  HTTP and HTTPS logs are located separately, i.e. apache.access.log and apache.ssl.access.log. In one file, the logs of both the main domain and the subdomain are launched simultaneously.

To view the log, first go to the logs directory using the cd command.

cd domeenid/www.yourdomain.eu/logs/

Use tail -f apache.ssl.access.log command to view all web server requests on the go. Now, when you refresh the website in the browser, your requests will be displayed in the logs. You can exit tail -f mode by pressing Ctrl + c.

In order to view only PHP requests, you can use an alias grep-php.

For example: grep-php apache.ssl.access.log or tail -f apache.ssl.access.log | grep-php.

At the end of each line, there is an 8-digit hash in parentheses, consisting of arbitrary numbers and letters, followed by a hyphen and time in seconds. For example: (94E76104-0.074) indicates that the corresponding request took 0.074 seconds or 74 milliseconds. If there are only three hyphens in parentheses ---, then the corresponding request did not go through the PHP interpreter.

Apart from the grep-php alias which shows all PHP requests, there are also aliases to filter out slow PHP requests.

grep-phpslow shows PHP requests that take more than 2 seconds to complete, and grep-phpveryslow shows PHP requests that take more than 10 seconds to complete.

 

Updated on 4. Oct 2024
Was this article helpful?

Related Articles