I am having trouble getting Timeout directive to work, I have reproduced the issue in the below instructions and official Docker container. The server is using the standard MPM prefork model with default configs. My understanding is that the Timeout should return a 500 error after the timeout or some sort of 4xx or 5xx response code but it doesn't. Is my understanding incorrect?
Setup:
mkdir /tmp/test; cd /tmp/test
echo "<?php sleep(10);" > index.php
docker run -d -p 80:80 --name apache-php -v "/tmp/test":/var/www/html php:5.6-apache
time curl http://localhost/ # should take 10 seconds
Now, lower timeout to 1 second:
docker cp apache-php:/etc/apache2/apache2.conf . # Copy to host, since container doesn't have editor.
echo "Timeout 1" >> apache2.conf # Set Timeout to 1, default is 300.
docker cp apache2.conf apache-php:/etc/apache2/apache2.conf # Copy conf file back to container
docker exec -it apache-php /bin/bash
service apache2 reload
exit # exit docker container.
Test for error:
time curl http://localhost/ # Here is where I expect a timeout error, but it works just the same as before and takes 10 seconds.
p.s. I have read that AcceptFilter can affect things until the request gets past it. We do have the below config as well:
AcceptFilter http none
AcceptFilter https none
Apache Timeout refers to TCP timeout, not script execution time. PHP timeouts are controlled via two directives located in php.ini:
From php.net
And (this is probably the one you need)