Jump to content
  • 0

Is Blesta Catching Php Error Logging?


will

Question

I'm trying to modify a module. There's a bug somewhere in it that's causing some kind of PHP error, rendering a 500 internal server error from nginx. However, there's no error in my php error log, making debugging exceedingly difficult. I've confirmed that logging works normally (e.g. if I write a simple php file with a syntax error).

 

Is Blesta intercepting PHP errors? Is it logging them anywhere?

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

Yes, as I said, it's not getting logged. Nothing to /var/log/nginx/access.log, /var/log/nginx/error.log, nor /var/log/nginx/php_errors.log, all of which I've confirmed normally receive logging output.

 

For example, if I visit a php page consisting of

<?php throw new Exception('Noooooo!'); ?>

I get

2014/08/26 11:48:17 [error] 19912#0: *83 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught exception 'Exception' with message 'Nooooo!' in /var/www/error.php:1
Stack trace:
#0 {main}
  thrown in /var/www/error.php on line 1" while reading response header from upstream, client: x.x.x.x, server: mydomain.com, request: "GET /error.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "mydomain.com"

After doing further research, it looks like Fatal errors bypass normal error handling. I thought perhaps this was the case here, so I made another error file.

<?php throw_error("Nooo!", E_USER_ERROR); ?>

but no luck; I still got a logged error.

2014/08/26 11:52:22 [error] 19912#0: *90 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Nooo! in /var/www/error.php on line 1" while reading response header from upstream, client: x.x.x.x, server: mydomain.com, request: "GET /error.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "mydomain.com"

I turned display_errors on. For my fatal error, I get

Fatal error: Nooo! in /var/www/error.php on line 1

However, for https://mydomain.com/index.php/admin/settings/company/modules/available/ I still get a blank page and nothing in the error log. I assume this means I have the wrong sort of Fatal error due to third-party documentation like http://blog.elijaa.org/index.php?post/2010/04/20/Handling-fatal-error-in-PHP-with-register_shutdown_function which describes the blank page I'm stuck with. Right now I'm trying to hunt down other ways to replicate this error. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...