Req #67546 [Opn->Csd]: Environment variables passed via php-fpm are hardlimited to 1024 chars
| From: | krakjoe@php.net | Date: | Sun, 15 Jan 2017 06:53:55 +0000 |
| Subject: | Req #67546 [Opn->Csd]: Environment variables passed via php-fpm are hardlimited to 1024 chars | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-206628@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67546&edit=1
ID: 67546
Updated by: krakjoe@php.net
Reported by: m at ttias dot be
Summary: Environment variables passed via php-fpm are
hardlimited to 1024 chars
-Status: Open
+Status: Closed
Type: Feature/Change Request
Package: FPM related
Operating System: n/a
PHP Version: 5.4.30
-Assigned To:
+Assigned To: krakjoe
Block user comment: N
Private report: N
New Comment:
This has been fixed and someone forgot to update the bug.
Version 7 of PHP should not be exhibit this behaviour.
Previous Comments:
------------------------------------------------------------------------
[2014-06-30 11:42:22] m at ttias dot be
Description:
------------
The current php-fpm implementation limits the size of environment variables, passed via the FPM pool
configurations, to 1024 chars. This limit is defined in $src/sapi/fpm/fpm/fpm_conf.c around line
1467, where fpm_conf_load_ini_file() is called.
If larger environment variables are passed through the FPM config to PHP, it will silently truncate
them and more than likely cause a configuration error because a trailing quote, to limit strings,
will be missing.
The resulting error, when trying to start the PHP-FPM service, looks like this.
Stopping php-fpm2: [FAILED]
Starting php-fpm: PHP: syntax error, unexpected $end in Unknown on line 1
[30-Jun-2014 13:24:36] ERROR: failed to load configuration file
'/etc/php-fpm.d/pool-site.conf'
[30-Jun-2014 13:24:36] ERROR: FPM initialization failed
Test script:
---------------
The "bug" is simple to reproduce, by defining an environment variable in the pool
configuration that exceeds 1024 chars. A pool configuration with the following details causes this.
[global]
...
[site]
listen = /var/run/php-fpm/site.socket
listen.backlog = 128
listen.allowed_clients = 127.0.0.1
env[TEST_VAR] =
'{"variable":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx!
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx!
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}}'
Expected result:
----------------
One of two things should happen:
- either throw a clear warning that more than 1024 characters were found, but they have been
silently removed (not optimal)
- throw a warning but allow the maximum PHP environment variables to be configured through a PHP.INI
setting
Actual result:
--------------
The pool fails to start, trigger the error:
Stopping php-fpm: [FAILED]
Starting php-fpm: PHP: syntax error, unexpected $end in Unknown on line 1
[30-Jun-2014 13:40:01] ERROR: failed to load configuration file
'/etc/php-fpm.d/pool-site.conf'
[30-Jun-2014 13:40:01] ERROR: FPM initialization failed
[FAILED]
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67546&edit=1