I've built a system using Codeigniter 3 and for some reason, only some users are getting a white screen. I'm trying to debug it and have logging turned up.
I'm getting the following errors in my logs:
Severity: Notice --> Use of undefined constant VIEWPATH - assumed 'VIEWPATH' /my/server/path/to/system/core/Common.php 196
Severity: Notice --> Use of undefined constant VIEWPATH - assumed 'VIEWPATH' /my/server/path/to/system/core/Exceptions.php 162
Severity: Warning --> include(): Failed opening 'VIEWPATHerrors/html/error_general.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') /my/server/path/to/system/core/Exceptions.php 182
So it seems that the core php files can't see the defined vars from the index file. But what's odd is if I define VIEWPATH at the top of Common.php it errors saying that VIEWPATH is already set. I added a log_message to my controller to output my VIEWPATH setting and it seems to work just fine.
I can't figure out how to get past this. Any ideas?
This is usually caused by not updating the index.php from an older version when upgrading CodeIgniter. The easy fix is to download the index.php file from the version you are upgrading to and replace the old index.php with it.
Thanks @abdulla, however, I found the problem. The index.php file was being bypassed for only some users that were somehow going to an old differently named file that was based on the CI2 build we did previously.
If anyone else runs into this problem, check to make sure you don't have any other "index" files in your root that users may be getting to.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With