简体   繁体   中英

Unable to get error stack trace or error log while using php-fpm + nginx

I am using php-fpm 5.5.9 along with nginx 1.4.6 on my Ubuntu 14.04 machine. I have installed them using apt-get package manager. I am unable to get a stack trace of the error that my index.php script encounters in error log as well as on the browser. I searched and implemented a couple of solutions from stackoverflow and other articles but none of them worked for me. Here is my nginx conf along with my php-fpm conf file. Please help me out if I am doing any silly mistake.

Nginx Configuration:

location ~ \.php$ {
        # With php5-fpm:
                #try_files $uri =404;
        include fastcgi_params;
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_intercept_errors on;
        fastcgi_read_timeout 600;
        fastcgi_send_timeout 600;
        proxy_connect_timeout  600;
        proxy_send_timeout  600s;
        proxy_read_timeout  600s;
        fastcgi_pass 127.0.0.1:7777;
        fastcgi_index index.php;
    }

PHP-FPM Configuration:

error_log = /tmp/php5-fpm.log

PHP-FPM pool Configuration:

catch_workers_output = yes 
slowlog = /var/log/php-fpm/$pool.log.slow
listen = 127.0.0.1:7777

php_flag[display_errors] = On 
php_admin_value[error_log] = /tmp/fpm-php.www.log 
php_admin_flag[log_errors] = On

Thanks in advance.

Honestly couldn't find reasonable solution without using PHP xdebug module.

sudo apt-get install php5-xdebug

It should install the module configuration, may have to restart php-fpm afterwards though.

sudo service php5-fpm restart

Once that was installed I could finally get a stack trace out from php5-fpm.

In your configuration is says that the error_log file is in /etc/... However you could just be looking in the wrong place.

Did you anyway check the default error log location? Usually it should be: /var/log/nginx/* - there is a nginx_error.log file in there. Possibly other log files as well.

Also note that the PHP-FPM and nginx config configurations differ in syntax. Check if you have such an error anywhere. It may be parsed wrongly and thus your errors.

Check file permissions for the error log. Is nginx's running user able to Write there?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM