php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #53695 Bugs are not outputed when using php-fpm
Submitted: 2011-01-08 13:01 UTC Modified: 2011-02-01 15:38 UTC
From: szoftos at freemail dot hu Assigned: fat (profile)
Status: Not a bug Package: FPM related
PHP Version: 5.3.5 OS: FreeBSD
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: szoftos at freemail dot hu
New email:
PHP Version: OS:

 

 [2011-01-08 13:01 UTC] szoftos at freemail dot hu
Description:
------------
Hi, when i was trying to see an error message because of a syntax error (or any other error) using php-fpm, it simply won't output. Sometimes i get nothing, and other times i get an '500 Server error'.

When i use php-cli, i get the error message.

my configure line (comes from freebsd ports): './configure' '--with-layout=GNU' '--localstatedir=/var' '--with-config-file-scan-dir=/usr/local/etc/php' '--disable-all' '--enable-libxml' '--with-libxml-dir=/usr/local' '--with-pcre-regex=/usr/local' '--with-zlib-dir=/usr' '--program-prefix=' '--enable-fpm' '--with-fpm-user=www' '--with-fpm-group=www' '--with-regex=php' '--with-zend-vm=CALL' '--enable-zend-multibyte' '--prefix=/usr/local' '--mandir=/usr/local/man' '--infodir=/usr/local/info/' '--build=amd64-portbld-freebsd8.1' 

The following extensions are compiled in:
[root@wwwjail ~]# cat /var/db/ports/php5-extensions/options
# This file is auto-generated by 'make config'.
# No user-servicable parts inside!
# Options for php5-extensions-1.4
_OPTIONS_READ=php5-extensions-1.4
WITHOUT_BCMATH=true
WITH_BZ2=true
WITH_CALENDAR=true
WITH_CTYPE=true
WITHOUT_CURL=true
WITHOUT_DBA=true
WITH_DOM=true
WITH_EXIF=true
WITHOUT_FILEINFO=true
WITHOUT_FILTER=true
WITHOUT_FRIBIDI=true
WITH_FTP=true
WITH_GD=true
WITH_GETTEXT=true
WITH_GMP=true
WITH_HASH=true
WITH_ICONV=true
WITH_IMAP=true
WITHOUT_INTERBASE=true
WITH_JSON=true
WITHOUT_LDAP=true
WITH_MBSTRING=true
WITHOUT_MCRYPT=true
WITHOUT_MSSQL=true
WITH_MYSQL=true
WITHOUT_MYSQLI=true
WITHOUT_ODBC=true
WITH_OPENSSL=true
WITHOUT_PCNTL=true
WITH_PDF=true
WITH_PDO=true
WITH_PDO_SQLITE=true
WITHOUT_PGSQL=true
WITH_POSIX=true
WITH_PSPELL=true
WITHOUT_READLINE=true
WITHOUT_RECODE=true
WITH_SESSION=true
WITHOUT_SHMOP=true
WITH_SIMPLEXML=true
WITHOUT_SNMP=true
WITH_SOAP=true
WITHOUT_SOCKETS=true
WITH_SQLITE=true
WITHOUT_SYBASE_CT=true
WITHOUT_SYSVMSG=true
WITHOUT_SYSVSEM=true
WITHOUT_SYSVSHM=true
WITHOUT_TIDY=true
WITH_TOKENIZER=true
WITHOUT_WDDX=true
WITH_XML=true
WITH_XMLREADER=true
WITH_XMLRPC=true
WITH_XMLWRITER=true
WITHOUT_XSL=true
WITHOUT_YAZ=true
WITH_ZIP=true
WITH_ZLIB=true

The related php-fpm.conf snippet is:
php_admin_value[error_reporting] = "E_ALL"
php_admin_flag[display_errors] = On
php_admin_flag[display_startup_errors] = On


Test script:
---------------
<?php
asdlkl;k
phpinfo();
?>


Expected result:
----------------
PHP Parse error:  syntax error, unexpected T_STRING in test.php on line 3


Actual result:
--------------
Nothing, or a '500 Internal server error' result.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-10 01:41 UTC] kalle@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: fat
 [2011-01-10 01:41 UTC] kalle@php.net
Hmm, I wonder if php-fpm is actually parsing the error_reporting constants with their numeric bitfields to mask it correctly, could be wrong here. Any thoughts fat?
 [2011-01-10 08:16 UTC] fat@php.net
Are you sure it's related to php fpm ?

Here is the content of a test file:
<?php asdlk;k; ?>

Calling from CLI: nothing, white page
Calling from FPM: the same

Here is the content of another test file:
<?php nofunc(); ?>

Calling from CLI: Fatal error: Call to undefined function nofunc() in 
/html/error.php on line 1
Calling from FPM: Fatal error: Call to undefined function nofunc() in 
/html/error.php on line 1

The behaviour is the same with CLI or FPM. 

@kalle:
can you reproduce the problem ?
 [2011-01-29 12:11 UTC] fat@php.net
-Status: Assigned +Status: Bogus
 [2011-01-29 12:11 UTC] fat@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

You must not use double (or simple) quotes arround E_ALL as constants are 
interpreted by the php core ini parser (quotes inhibits this conversion)

php_admin_value[error_reporting] = "E_ALL" is not well understood. 

php_admin_value[error_reporting] = E_ALL is correctely converted.
 [2011-01-29 15:10 UTC] szoftos at freemail dot hu
Ah, thank you, i'll try the configuration without quotes. However, I was thinking that the php_admin_value should be set in the same way as for the mod_php module in apache. In there, one has to use quotes.

Maybe this should be a remark for php-fpm's config.
 [2011-02-01 15:38 UTC] szoftos at freemail dot hu
Okay, this is still a bug, and not a bogus one.

I changed the configuration, right now these are all the config lines for the given virtualhost:

--------------------------------
[virtualhost]
chroot = /usr/local/www/
chdir = /vhosts/virtualhost/htdocs
listen = /usr/local/www/var/run/sockets/virtualhost.php.sock
listen.owner = www
listen.group = www
listen.mode = 0660
user = username
group = groupname
pm = dynamic
pm.max_children = 50
pm.start_servers = 1
pm.min_spare_servers = 1
pm.max_spare_servers = 5
pm.max_requests = 200
request_terminate_timeout = 1m
request_slowlog_timeout = 30s
slowlog = /var/log/php-fpm-slow.log
catch_workers_output = yes
php_admin_flag[register_globals] = off
php_admin_value[variables_order] = GPCES
php_admin_value[date.timezone] = Europe/Budapest
php_admin_flag[always_populate_raw_post_data] = on
php_admin_value[open_basedir] = /vhosts/virtualhost/htdocs
php_admin_value[doc_root] = /vhosts/virtualhost/htdocs
php_admin_value[upload_tmp_dir] = /vhosts/virtualhost/htdocs/tmp
php_admin_flag[zlib.output_compression] = on
php_admin_flag[safe_mode] = on
php_admin_value[disable_functions] = escapeshellarg,escapeshellcmd,exec,passthru,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,system
php_admin_flag[magic_quotes_gpc] = on
php_admin_flag[magic_quotes_runtime] = off
php_admin_flag[magic_quotes_sybase] = off
php_admin_value[session.save_path] = /vhosts/virtualhost/htdocs/admin/tmp
php_admin_value[safe_mode_exec_dir] = /vhosts/virtualhost/safe_mode_exec_dir
php_admin_value[memory_limit] = 32M
php_admin_flag[short_open_tag] = on
php_admin_value[default_charset] = UTF-8
php_admin_value[error_reporting] = E_ALL & ~E_NOTICE
php_admin_flag[display_errors] = On
php_admin_flag[display_startup_errors] = On
--------------------------------

As you can see, all without quotes now. The mentioned example code runs now with the same results: no output at all, when commenting out the phpinfo() from it.

Please reopen the bug, as this is _not_ a bogus report.

Cheers,
Laszlo
 [2011-02-24 15:37 UTC] arnoschn at gmail dot com
Hello,

I ran into the same problem.


Setting this in your php-fpm.conf helps:

php_admin_value[error_log] = "/var/log/php-fpm-errors.log"

Then I saw the errors still showing up in nginx, so I looked at the user I was using to run nginx. It is "www-data".

So I created the file "/var/log/php-fpm-errors.log" and gave permissions to "www-data" to write to it.

Solved.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 12:01:30 2024 UTC