Anonymous Anonymous - 1 year ago 226
PHP Question

PHP Fatal Error Failed opening required File

I am getting the following error from Apache

[Sat Mar 19 23:10:50 2011] [warn] mod_fcgid: stderr: PHP Fatal error: require_once() [function.require]: Failed opening required '/common/configs/' (include_path='.:/usr/share/pear:/usr/share/php') in /home/viapics1/public_html/common/configs/ on line 158

I am definately not an expert of Apache but the file & are there. I also tried navigating to a test.html page I placed in common/configs/ so I assume there is no rights issues going on. I also set the rights on to give everyone read, write, and execute rights. Not sure what to do at this point, I checked to see if there was a /usr/share/php directory and I found there was not but when I did yum install php it said it had the latest. Ideas?

Answer Source

It's not actually apache related question. nor even PHP related.
You have to distinguish virtual server path from filesystem path.

There are no
file on the server but rather

if you change your code to something like


it will work.
also, if you're sure that templates will always remain the same directory, you can write absolute path this way:


Or since PHP 5.3 you can use __DIR__ instead: