Same-directory includes failing on a Fedora server with PHP.

Posted by JimmySawczuk on Stack Overflow See other posts from Stack Overflow or by JimmySawczuk
Published on 2010-06-12T02:41:22Z Indexed on 2010/06/12 2:52 UTC
Read the original article Hit count: 240

Filed under:
|
|
|

I have a couple files that look like this:

index.php:

<?php  
include('includes/header.php');

...

includes/header.php:

<?php
include('config.php');

...

The error I get is

Warning: require(config.php) [function.require]: failed to open stream: No such file or directory in [dir]/includes/header.php on line 2
Fatal error: require() [function.require]: Failed opening required 'config.php' (include_path='.:/usr/share/pear:/usr/share/php') in [dir]/includes/header.php on line 2

I did some further debugging: when I add the call

system('pwd');

to includes/header.php, it shows [dir], where it should say [dir]/includes. Adding the 'includes/' to the include path works, but isn't desirable because that would fail on the production server.

The above code works on a production server, and worked fine on my development Fedora server, until I tried to change my development environment so that the Fedora server's document root is a mounted CIFS share.

Any ideas? Thanks.

© Stack Overflow or respective owner

Related posts about php

Related posts about linux