Page 1 of 1

Absolute include path failing on Fedora 13

Posted: Tue Jan 18, 2011 1:06 pm
by wesmat
I have an existing php app suite working without error on Ubuntu that must be moved to Fedora. The entire app uses absolute paths for all includes to /usr/local/apache/php. I have created the same path structure in Fedora. I put together a test file that shows the problem:

Code: Select all

<?php phpinfo();
include ("/usr/local/apache/php/connect.inc");
?>
and I get this error:
[text][Tue Jan 18 13:48:39 2011] [error] [client 127.0.0.1] PHP Warning: include(): Failed opening '/usr/local/apache/php/connect.inc' for inclusion (include_path='.:/var/php:/usr/local/apache/php') in /var/www/html/phpinfo.php on line 2[/text]
'ls -l' shows:
[text]-rwxrwxrwx. 1 apache apache 473 Nov 12 08:23 /usr/local/apache/php/connect.inc[/text]
I am stumped - what else is there to restrict access to the file? I thought an absolute path include didn't need anything set but its access rights, but that didn't work so I have opened everything I could think of. As you can see the file exists; it is in the php include_path; I have given the file full access rights; and it belongs to the apache user and apache group.

How do I enable absolute path includes? Changing the source is not an option - there are over 450 files in the app and ALL of them at a minimum include connect.inc to gain access to the db.

Re: Absolute include path failing on Fedora 13

Posted: Fri Jan 21, 2011 9:23 am
by wesmat
I am now convinced something more basic is wrong. I decided to try removing the absolute path (since keeping the full path was not getting solved) and found that they don't work either. Removing the path throws this error:
[text][Fri Jan 21 10:10:37 2011] [error] [client 127.0.0.1] PHP Warning: include(): Failed opening 'connect.inc' for inclusion (include_path='.:/var/php:/usr/local/apache/php') in /var/www/html/phpinfo.php on line 2[/text]
So obviously there is something not configured properly to allow includes. Any ideas?

Re: Absolute include path failing on Fedora 13

Posted: Fri Jan 21, 2011 9:57 am
by wesmat
Arrrrg! SELinux is to blame. It was preventing httpd from accessing the files. Everything was installed with yum and I didn't consider that apache didn't have rights to include files.