0

I am actually working on Apache server 2.4 with PHP 8.2 (mod_php) & debian 11.2

Recently I sent a HTTP Request with more than 100 seconds without a timeout. This request executed a large MySQL request.

I configured Apache (/etc/apache2/apache2.conf) with

Timeout 10

I configured PHP ini (/etc/php/8.2/apache2/php.ini) with

max_execution_time = 10
max_input_time = 10

But my request took more than 10 seconds.

From PHP documentation https://www.php.net/manual/en/configuration.changes.php

I have added php_value in my vhost

<VirtualHost *:8088>
  DocumentRoot /var/www/public
  <Directory /var/www/public>
    AllowOverride All
    Require all granted
    Options Indexes FollowSymLinks

    php_value max_execution_time 10
  </Directory>
</VirtualHost>

Same result even if there is a good configuration in phpinfo()

So my question is : how to handle timeout with Apache & mod_php ?

Thanks

1 Answer 1

0

I've finded my response.

The problem is not from Apache or PHP, but from MySQL.

For Apache, we have Timeout which corresponding to timeout when server wait for client request https://httpd.apache.org/docs/2.4/mod/mod_reqtimeout.html

For PHP, max_execution_time means number of second of execution about PHP script and only PHP. A MySQL request which take one hour is not counted by max_execution_time.

So, in MySQL we also have max_execution_time since 5.7 https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_max_execution_time

In my case, if I have a sql request which take 1 hour and a PHP script which take 5 seconds then I don't have timeout.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .