Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

php

nginx

php-5.5

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.

like image 882
Tojo Chacko Avatar asked Aug 01 '26 13:08

Tojo Chacko


1 Answers

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.

like image 63
Justin Fortier Avatar answered Aug 04 '26 03:08

Justin Fortier



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!