Php: Always max_execution_time equal zero

Created on 1 May 2019  路  4Comments  路  Source: docker-library/php

Hello.

I tried change max_execution_time in:

  1. php.ini
  2. zz-docker.conf
  3. nignx.conf

But local directive not changed and always equal zero.
screen

PHP 7.3.3 - phpinfo().html.txt

question

All 4 comments

It looks like you're trying to change a rather unique variable that doesn't respect *.ini values when php is running "from the command line"

The documentation mentions this special property. It states you can modify this by "changing the time limit in the php.ini." however the php.ini-production has a value of 30 and isn't respected, and adding an additional *.ini to the $PHP_INI_DIR/conf.d/ also won't be respected for this variable.

$ docker run --rm php grep execution_time /usr/local/etc/php/php.ini-production
max_execution_time = 30

Dockerfile

FROM php

RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
COPY test.ini $PHP_INI_DIR/conf.d/

test.ini

max_execution_time = 66
max_file_uploads = 1337

Here the max_execution_time is unmodified by either *.ini while the max_file_uploads is

$ docker run -dit --rm --name php php:test
8f28ab2995e1ea78638ee62e8f5155bcf6f1124d2f63f6aeca4d22f9a7345350

$ docker exec php php -i | grep '.ini'
Configuration File (php.ini) Path => /usr/local/etc/php
Loaded Configuration File => /usr/local/etc/php/php.ini
Scan this dir for additional .ini files => /usr/local/etc/php/conf.d
Additional .ini files parsed => /usr/local/etc/php/conf.d/docker-php-ext-sodium.ini,
/usr/local/etc/php/conf.d/test.ini
. . .

$ docker exec php php -i | grep -C 1 execution
mail.log => no value => no value
max_execution_time => 0 => 0
max_file_uploads => 1337 => 1337

Will need to look into this more

So invoking php in the container is considered "running from the command line" and will force the value to 0, however when php is invoked from apache or something else it will have its intended value.

As you had done through the phpinfo() initially, the correct value would then be displayed, so you seem to have a misconfiguration where php isn't reading the value at all.

$ docker exec -it php bash
root@2ead66bdb368:/var/www/html# echo '<?php phpinfo();' > index.php

root@2ead66bdb368:/var/www/html# curl -s localhost | grep execution 
<tr><td class="e">max_execution_time</td><td class="v">66</td><td class="v">66</td></tr>

root@2ead66bdb368:/var/www/html# php -i | grep execution
max_execution_time => 0 => 0

So on the curl the value is correctly set when php is invoked from apache

Thank you for answer.
Problem was xdebug, should remote_enable=off.

Nice, glad you got it figured.

In the future, these sorts of questions/requests would be more appropriately posted to the Docker Community Forums, the Docker Community Slack, or Stack Overflow. Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ktrzos picture ktrzos  路  3Comments

skyzyx picture skyzyx  路  3Comments

cmath10 picture cmath10  路  3Comments

PMExtra picture PMExtra  路  3Comments

mikk150 picture mikk150  路  3Comments