php7 timeout not enforced
<p>I've been searching for why for the past 2 days and I tried a lot of solutions on the internet and here on stack.</p>

<p>I have a dedicated VM with ubuntu 16.04 with apache2 -> Server version: Apache/2.4.18 (Ubuntu) with the default php instalation: 
php -v </p>

<pre><code>PHP 7.0.8-0ubuntu0.16.04.2 (cli) ( NTS ).
</code></pre>

<p>phpinfo()</p>

<pre><code>PHP Version 7.0.8-0ubuntu0.16.04.2
</code></pre>

<p>Recently I noticed that the scripts can run for forever, there is no timeout limit enforced.</p>

<p>I did a phpinfo() to get the php.ini file used. I checked inside the php.ini the following parameters:</p>

<pre><code>default_socket_timeout = 60
session.gc_maxlifetime = 1440
max_execution_time = 30
max_input_time = 60
</code></pre>

<p>I even set them to 3 seconds (max_execution_time, max_input_time and default_socket_timeout), restarted apache, but with no results.</p>

<p>The following code for example (and it's not the only one i tried) doesn't time out, it runs until it finishes:</p>

<pre><code>echo "&lt;br&gt;initial max_execution_time: " . ini_get('max_execution_time') ;
print_r(set_time_limit(2));
echo " - set_time_limit\n";
echo "&lt;br&gt;initial max_execution_time: " . ini_get('max_execution_time') ;
ini_set('max_execution_time', '1');
echo "&lt;br&gt;initial max_execution_time: " . ini_get('max_execution_time') ;
ini_set('default_socket_timeout','1');
echo "&lt;br&gt;ini_get('default_socket_timeout')". ini_get('default_socket_timeout');
//phpinfo();


set_time_limit(1);
$i = 0;
while(++$i &lt; 1000000001){
        if($i % 100000 == 0){
                echo $i / 100000, "&lt;br/&gt;\n";
        }
}
echo "done.&lt;br/&gt;\n";
</code></pre>

<p>The output is telling me that the timeouts are correctly set, but like I said, the script is running for 32seconds without being killed.</p>

<p>Any ideas why the timeouts are not applied?</p>

<p>Thanks</p>