rryqszq4 / ngx-php

ngx-php - Embedded php7 or php8 scripting language for nginx module. Mainline development version of the ngx-php.
BSD 2-Clause "Simplified" License
627 stars 56 forks source link

Show errors #21

Open joanhey opened 5 years ago

joanhey commented 5 years ago

When there are errors never return a 4xx or 5xx. Always return a socket read error.

So we don't know if it is a problem with PHP or with the socket or nginx.

The error log show exactly the errors.

rryqszq4 commented 5 years ago

@joanhey I commited an PR to fix the problem, return 500 when there're some PHP errors. https://github.com/rryqszq4/ngx_php7/pull/22

joanhey commented 5 years ago

And a 404 when can't include a php file from the nginx config. If it's possible. Perhaps add an ngx_include (file) in php or php_include(file) in nginx config, for use in the nginx config and raise a 404 error when fail. The rest of php normal include will show a 500 error.

I don't know if actually can intercept the headers from apps to send it to the client.

But the 500 is good for now.

rryqszq4 commented 5 years ago

@joanhey The nginx directive of include php file is unstable at present, so i have not release it. I think that return 404 when not found file was can be achieve.