I have a PHP script which is failing on a require_once() statement, and I can't figure out why. Here is some test code I've come up with:
if(require_once("lib/modules/events/events.inc.php")){ print "Events module loaded!"; }
if(require_once("lib/modules/events/bills.inc.php")){ print "Bills module loaded!"; }
The first line works fine.
The second line fails. If I try commenting out the first line and running the second line by itself, I get a blank white page, and the headers that the server sends say "500 Internal Server Error."
Apache is not logging this error, as far as I can tell. There is only one error_log file (I checked all the vhosts, and they all use the default error_log). If I tail -f /var/log/httpd/error_log
and reproduce the problem, nothing is logged.
I have verified that both files exist, in the same directory, and have the same permissions:
# ls -hal *.inc.php
-rwxrwxr-x. 1 wdmartin wdmartin 83K Aug 15 11:30 bills.inc.php
-rwxrwxr-x. 1 wdmartin wdmartin 15K Mar 5 2015 events.inc.php
Since the server is RHEL with SE Linux, I've checked that they both have the same SE Linux security context:
# ls -Z *.inc.php
-rwxrwxr-x. wdmartin wdmartin unconfined_u:object_r:httpd_sys_content_t:s0 bills.inc.php
-rwxrwxr-x. wdmartin wdmartin unconfined_u:object_r:httpd_sys_content_t:s0 events.inc.php
According to get_include_path
, the include path starts with .
, which should work because the paths were constructed to start relative to executing script. And it DOES work for the events.inc.php file. It's just the bills.inc.php file in the same folder that doesn't work.
I tried opening both files in a hex editor to see if one or the other of them had a UTF-8 byte order mark, since those can sometimes trip up programs that don't understand them, but neither file had one.
The bills.inc.php file works just fine on our dev server, but not in production. I don't get it. It should work. Failing that, it should at least log an error to tell me what the heck is going wrong. Any suggestions welcome.
EDIT:
For the record, I have turned on ini_set('display_errors', 1);
and set error_reporting(E_ALL)
for debug purposes. No errors are reported. If I run the second line, I get a white screen.
EDIT:
It turns out there was a typo in my call to ini_set
, and so errors weren't actually displaying. Once I fixed that it turned out to be a normal parse error. My apologies for posting too soon.