4

I have browsed several other questions, and tried various solutions related to error reporting, including

ini_set('display_errors',true);
error_reporting(E_ALL);

but I am still stuck with the white screen of death. This seems to happen only on pages when I use my own object oriented classes. However, the OOP scripts execute successfully, but I am unable to get the HTML to show. Occasionally, I can get it to catch an Exception but it is intermittent.

For example, I have a this method:

public function getSubdomain() {
        $this->data->query('SELECT * FROM users WHERE email=:email');
        $this->data->bind(':email', $this->email);
        $this->data->execute();
        if($this->data->rowCount() == 0)
            throw new Exception('There is no account associated with this e-mail address.');
        $curr = $this->data->single();

        return $curr['subdomain'];
    }

^^ That will execute just fine and I can get it to print from the OOP class using die($curr['subdomain']);, but if I try displaying it on a page using PHP, nothing. No errors, so logs, no source code, absolutely nothing.

I am using MultiViews with Apache, and my DB queries are done using a custom PDO class.

I have run

# php -l new.php

directly on the server and it reports

No syntax errors detected in new.php

When I run the exact same setup on WAMP locally, it works without a problem, but once I migrated over to my CentOS/Apache/PHP machine, all hell broke loose. MySQL is on a seperate server, but has no problems.

I can provide much more specific code (both my own and conf files from the server) as needed, I just want to avoid anything arbitrary due to the nature of the question. Any suggestions on where to go from here (ie, different methods of error reporting, etc.)?

brokekidweb
  • 157
  • 1
  • 4
  • 11
  • Do you have liberal error logging turned on? – Machavity Oct 28 '13 at 01:52
  • Enable display_errors and _reporting in the php.ini, in case of syntax errors it's way too late in any script. Also peek at your webservers error.log for runtime errors. Add piles of debug output if unfruitful, else use an IDE with xdebug for stepping through. – mario Oct 28 '13 at 01:52
  • Make sure you have logging enabled in your php.ini and outputting to an error log. Sending php errors to the browser is not always reliable. Use Chrome to see if the server is sending a 500 status code. If so, check the Apache log for errors. Make sure Apache error logging is enabled. I often get white screens from invalid .htaccess files. – Reactgular Oct 28 '13 at 02:15
  • As code work on local Wamp, So it is confirmed that no syntax errors will be in code. You must check environment differences like php/mysql versions, missing functionality, php/mysql/apache(.htaccess) settings. While apache log will help you just verify them if you really checking correct log file. – kuldeep.kamboj Oct 28 '13 at 09:34
  • I did a full reinstall of PHP on my server. Then I used `ini_set('display_errors',true); error_reporting(E_ALL);` to show various errors. It seems as though PHP is having a little bit of a problem with uncaught exceptions. Eclipse didn't really do much, as it wasn't a syntax error. Also, I rewrote my .htaccess right into Apache httpd.conf. A few other fixes: case-sensitivity in file names (ie .PHP vs .php), properly configuring external classes for server use, and more robust exception handling through an extended Exception class. Seemed to be a myriad of things so hopefully this comment helps – brokekidweb Oct 31 '13 at 14:13
  • Hi, please, add that as an answer instead of a comment and mark it as correct, so anyone may see directly what happened. – Federico J. Jul 23 '15 at 13:47

2 Answers2

0

Most times, when errors appear when we move from WAMP to LAMP it's a question of case sensitivity. Since windows is not CS but Linux is a lot can break.

I would:

  • Check case on the classes / pages that are acting up
  • Check .htaccess rules (or temporally remove them) to check the absence of errors
Ricardo Gomes
  • 1,268
  • 2
  • 15
  • 35
0

I've also encountered PHP's white screen of death a few times. In my experience one of the most helpful things you can do is ensure PHP is logging to file using the error_log directive in php.ini: http://us1.php.net/manual/en/errorfunc.configuration.php#ini.error-log

If you're still not seeing any useful information in the PHP error log you've defined, or in the Apache error log, it might be time to add debug output through your code to identify the point at which the fatal error occurs. To do that you can either open a file handle and write to it yourself periodically, or just use the error_log() function to output debug messages.

JM NZ
  • 189
  • 1
  • 7