newttster Posted April 4, 2019 Share Posted April 4, 2019 Hey folks. I've tried repeatedly to get error messages to show on a game that I'm working on. You know those messages that say something like "unexpected { or ;". Those kinds of messages. For that matter, I'm not getting any of the error messages to popup. When there is an error in the code, I'm just getting a blank white screen. Now, if it's a minimum number of lines of code, it's usually easy enough to find, right. But when you have a lot of lines of code, you can spend hours by blocking certain code, trying it, then unblocking the next and so on to find the error. Any ideas on what I can do to get this to work? Any help/suggestions would be greatly appreciated. Thanks a bunch. Quote Link to comment Share on other sites More sharing options...
Magictallguy Posted April 4, 2019 Share Posted April 4, 2019 At the top of globals.php and globals_nonauth.php, add ini_set('display_errors','On'); error_reporting(E_ALL & ~E_NOTICE); If that doesn't work, and you have SSH access, I'd recommend installing the Composer package filp/whoops. 3 lines later, and you've got all the information you need. I'd also recommend caution when using this as the default setup will expose raw code (perhaps lock the handler registration to your own ID/staff rank?) If you don't have SSH access, or composer isn't an option, then check the Error Log. If the server on which the site is hosted is using cPanel, the Error Log can be easily accessed directly from within. If that's not an option, then a logfile should be available within your system. Without knowing more about your setup, I can't really advise further 2 Quote Link to comment Share on other sites More sharing options...
Alan Posted April 5, 2019 Share Posted April 5, 2019 unexpected { or ; are pretty much game over as far as PHP is concerned and while logs help, packages have limited use here as syntax errors often prevent them from operating. I would suggest that any changes where you may be unsure you test locally. Assuming your local system works ... (you are testing aren't you?) ... then there should not be a problem - negating minor version differences in OS/PHP version etc. Next is to run your files through php -l: find . -iname "*php" -exec php -l {} \; this will point any any syntax errors in your code along with a handy line number that suggests where the problem is. You can also run this on a file-by-file basis with php -l <filename>.php If you are using git, it is possible to add this as a pre-commit hook which can save a few headaches. 1 Quote Link to comment Share on other sites More sharing options...
SRB Posted April 5, 2019 Share Posted April 5, 2019 13 hours ago, newttster said: Hey folks. I've tried repeatedly to get error messages to show on a game that I'm working on. You know those messages that say something like "unexpected { or ;". Those kinds of messages. For that matter, I'm not getting any of the error messages to popup. When there is an error in the code, I'm just getting a blank white screen. Now, if it's a minimum number of lines of code, it's usually easy enough to find, right. But when you have a lot of lines of code, you can spend hours by blocking certain code, trying it, then unblocking the next and so on to find the error. Any ideas on what I can do to get this to work? Any help/suggestions would be greatly appreciated. Thanks a bunch. Use PHPStorm and you'll have less as it highlights them magically! 1 Quote Link to comment Share on other sites More sharing options...
Alan Posted April 5, 2019 Share Posted April 5, 2019 My learned friend above is quite right; using PHP Storm can be a lifesaver in reducing the number of bugs reaching production; although I'd still point out that testing is ultimately key as many errors have been seen that escape Storm's otherwise beady eye. Test, test and test again. Use PHPUnit for writing tests; use Xdebug for profiling your application; between the two you can produce test coverage in excess of 100% which makes future modifications, upgrades, additions etc a lot safer. 1 Quote Link to comment Share on other sites More sharing options...
newttster Posted May 14, 2021 Author Share Posted May 14, 2021 (edited) I'm still having the same problem with white pages when there's an error. And yeah ... I'd like to get PHPStorm but I'm not paying $199 USD for it. I'd rather throw $20 or $30 or some agreed upon price to someone here who is trustworthy to set it up for me. Annnddd ... I really like Notepad++. So ... Anyone interested? Message me. Thanks. 🙂 Edited May 14, 2021 by newttster Quote Link to comment Share on other sites More sharing options...
AdamHull Posted May 14, 2021 Share Posted May 14, 2021 Check your apache2 or nginx error logs this will tell you why you have a white page Quote Link to comment Share on other sites More sharing options...
Sim Posted May 14, 2021 Share Posted May 14, 2021 I use notepad++ myself. Quote Link to comment Share on other sites More sharing options...
newttster Posted May 15, 2021 Author Share Posted May 15, 2021 On 5/14/2021 at 11:23 AM, AdamHull said: Check your apache2 or nginx error logs this will tell you why you have a white page I've looked everywhere for those error logs and I can't find them. Where do I find them? On 5/14/2021 at 1:17 PM, Sim said: I use notepad++ myself. It doesn't let me down. Except for those pesky white page errors. So ... is anyone interested in setting things up so that the error messages display instead of me getting a blank white page? I'd be willing to pay you for your time. Let me know it private message. Thanks all. Quote Link to comment Share on other sites More sharing options...
Sim Posted May 15, 2021 Share Posted May 15, 2021 You should be able to fix white errors with error_display(#); function.. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.