5

I am trying to set a large value in the configuration of a pool in php-fpm, but at some point it just doesn't start anymore.

php_admin_value[disable_functions] = dl,exec,passthru,shell_exec,system,proc_open,popen,curl_exec,curl_multi_exec,parse_ini_file,show_source,pcntl_exec,include,include_once,require,require_once,posix_mkfifo,posix_getlogin,posix_ttyname,getenv,get_current_use,proc_get_status,get_cfg_va,disk_free_space,disk_total_space,diskfreespace,getcwd,getlastmo,getmygid,getmyinode,getmypid,getmyuid,ini_set,mail,proc_nice,proc_terminate,proc_close,pfsockopen,fsockopen,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,fopen,tmpfile,bzopen,gzopen,chgrp,chmod,chown,copy,file_put_contents,lchgrp,lchown,link,mkdi,move_uploaded_file,rename,rmdi,symlink,tempnam,touch,unlink,iptcembed,ftp_get,ftp_nb_get,file_exists,file_get_contents,file,fileatime,filectime,filegroup,fileinode,filemtime,fileowne,fileperms,filesize,filetype,glob,is_di,is_executable,is_file,is_link,is_readable,is_uploaded_file,is_writable,is_writeable,linkinfo,lstat,parse_ini_file,pathinfo,readfile,readlink,realpath,stat,gzfile,create_function

When trying to restart php-fpm it fails with the following message:

Stopping php-fpm:                                          [  OK  ]
Starting php-fpm: [20-Oct-2013 22:31:52] ERROR: [/etc/php-fpm.d/codepad.conf:235] value is NULL for a ZEND_INI_PARSER_ENTRY
[20-Oct-2013 22:31:52] ERROR: Unable to include /etc/php-fpm.d/codepad.conf from /etc/php-fpm.conf at line 235
[20-Oct-2013 22:31:52] ERROR: failed to load configuration file '/etc/php-fpm.conf'
[20-Oct-2013 22:31:52] ERROR: FPM initialization failed
                                                           [FAILED]

When I remove the last disabled function (create_function) it start again. I also tried with other functions, but this gives the same error so it's not related to the create_function function.

The string currently is just over 1KB in size so it looks like I have hit a limit here?

Is my assumption correct? Is there a way to overcome this limit?

I also tried to add another php_admin_value[disable_functions] underneath it (hoping it would be appended), but that didn't work (it just used the first one).

  • 1
    What about removing the extensions you do not need and strip this list down? Unless you run PHP as root (shudder), disabling chown does not make your installation more secure for example. – Lekensteyn Oct 20 '13 at 21:38
  • I have this issue for PHP 5.6.36. Reinstall PHP 5.6.25 solves this issue. This may not be a solution, but can be a workaround if you are in emergency using. – zhm Jun 19 '18 at 13:47
5

This is a php-fpm bug.

There is a hard-coded 1024 character line length limit in the ini read cycle, which can be seen here:

http://lxr.php.net/xref/PHP_5_5/sapi/fpm/fpm/fpm_conf.c#1495

So at the moment, you're kind of out of luck - because the read buffer is sizeof(char) * (1024+1) bytes and it looks for a new-line as a terminator, there's nothing you can do to make it understand a configuration directive longer than this.

I've reported a bug and plan to take a look at resolving it in the next few days.

Edit: I've now create a PR with a fix for this bug.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.