PHP app slow request logs
An app’s PHP slow request log contains records of every PHP request that took more than five seconds to execute.
View the logs
An app’s PHP slow request logs can be viewed from within the ServerPilot dashboard or through SSH.
Log file location
Relative to the home directory of the app’s system user, the path to an app’s PHP slow request log is:
log/APPNAME/APPNAME_php8.4.slow.log
log/APPNAME/APPNAME_php8.3.slow.log
log/APPNAME/APPNAME_php8.2.slow.log
log/APPNAME/APPNAME_php8.1.slow.log
log/APPNAME/APPNAME_php8.0.slow.log
log/APPNAME/APPNAME_php7.4.slow.log
log/APPNAME/APPNAME_php7.3.slow.log
log/APPNAME/APPNAME_php7.2.slow.log
log/APPNAME/APPNAME_php7.1.slow.log
log/APPNAME/APPNAME_php7.0.slow.log
log/APPNAME/APPNAME_php5.6.slow.log
where APPNAME
is the name of the app.
Log file format
Each entry in an app’s PHP slow request log is a stack trace showing what code was executing at the moment the request passed five seconds in execution time.
A blank line will separate each stack trace in the log file.
For example, a PHP slow request with two entries may contain the following:
[04-Mar-2025 19:32:43] [pool APPNAME] pid 1852script_filename = /srv/users/SYSUSER/apps/APPNAME/public/index.php[0x00007f7e475ba138] curl_exec() /srv/users/SYSUSER/apps/APPNAME/public/wp-content/plugins/wp-piwik/classes/WP_Piwik/Request/Rest.php:44[0x00007f7e475b9f10] curl() /srv/users/SYSUSER/apps/APPNAME/public/wp-content/plugins/wp-piwik/classes/WP_Piwik/Request/Rest.php:20[0x00007f7e475b9d48] request() /srv/users/SYSUSER/apps/APPNAME/public/wp-content/plugins/wp-piwik/classes/WP_Piwik/Request.php:63[0x00007f7e475b9be0] perform() /srv/users/SYSUSER/apps/APPNAME/public/wp-content/plugins/wp-piwik/classes/WP_Piwik.php:941[0x00007f7e475b99f8] request() /srv/users/SYSUSER/apps/APPNAME/public/wp-content/plugins/wp-piwik/classes/WP_Piwik.php:1098[0x00007f7e475b98b8] updateTrackingCode() /srv/users/SYSUSER/apps/APPNAME/public/wp-content/plugins/wp-piwik/classes/WP_Piwik/TrackingCode.php:16[0x00007f7e475b9720] __construct() /srv/users/SYSUSER/apps/APPNAME/public/wp-content/plugins/wp-piwik/classes/WP_Piwik.php:288[0x00007f7e475b9540] call_user_func_array() /srv/users/SYSUSER/apps/APPNAME/public/wp-includes/plugin.php:503[0x00007f7e475b9428] do_action() /srv/users/SYSUSER/apps/APPNAME/public/wp-includes/general-template.php:2284[0x00007f7e475b9358] wp_footer() /srv/users/SYSUSER/apps/APPNAME/public/wp-content/themes/k2/footer.php:17
[04-Mar-2025 19:37:19] [pool APPNAME] pid 3969script_filename = /srv/users/SYSUSER/apps/APPNAME/public/index.php[0x00007f185ee134e0] mysqli_query() /srv/users/SYSUSER/apps/APPNAME/public/db.php:789[0x00007f185ee13400] getBlogPostTags() /srv/users/SYSUSER/apps/APPNAME/public/example.php:123
The first line of an entry shows the date and time when the slow request was logged:
[04-Mar-2025 19:37:19] [pool APPNAME] pid 3969
The second line of an entry shows the script that was initially requested:
script_filename = /srv/users/SYSUSER/apps/APPNAME/public/index.php
The stack trace begins on the third line. The first line in the stack track is the function that was executing at the time the slow request was logged. This function is often but not always the cause of the slow script execution. The rest of the lines in the stack trace are the function calls that led up to the currently executing function.
[0x00007f185ee134e0] mysqli_query() /srv/users/SYSUSER/apps/APPNAME/public/db.php:789[0x00007f185ee13400] getBlogPostTags() /srv/users/SYSUSER/apps/APPNAME/public/example.php:123
For each line in the stack trace, there are three fields:
- an internal identifier you can ignore (example:
[0x00007f7e475ba138]
) - the name of the function (example:
curl_exec()
) - the file name and line number of the function (example:
/srv/users/.../Request/Rest.php:44
)
You will sometimes see +++ dump failed
at the bottom of a stack trace.
You can ignore this line, it does not indicate a problem.
Causes of slow requests
There are a few common causes of slow requests.
curl_exec()
When the curl_exec()
function is at the top of a stack trace,
this means an HTTP(S) request performed by the app’s PHP code
is taking a long time to complete.
This can happen, for example, if the app’s PHP code makes requests to
an external API and that external API is slow.
mysqli_query()
When the mysqli_query()
function is at the top of a stack trace,
this often means the SQL queries the app is performing are executing slowly.
Possible causes of slow SQL queries include:
- Lack of proper indexes in the database schema.
- The MySQL InnoDB buffer pool size (the MySQL cache size) needs to be increased.
- The server’s CPU and/or memory need to be increased.
Acceptable causes of slow requests
You can safely ignore entries in an app’s PHP slow request log
that are related to requests performed by cron jobs or
the WordPRess wp-cron.php
script.
These requests are automated and their slowness does not indicate
a slow experience for site visitors.
Example commands
View an app’s recent slow requests
View the 100 most recent entries in an app’s PHP mail log
(replace APPNAME
with the name of the app):
tail -n 100 log/APPNAME/*.slow.log