...

View Full Version : Include File Not Opening - *SOLVED*



TheShaner
08-09-2007, 05:17 PM
I have a page called test.php in public_html that has the 2nd line like so:

require_once 'myscript.php';
myscript.php is in a directory called include that is in the public_html directory.

I receive this error when I run test.php:

Warning: require_once(myscript.php) [function.require-once]: failed to open stream: No such file or directory in /home/user/public_html/test.php on line 2

Fatal error: require_once() [function.require]: Failed opening required 'myscript.php' (include_path='.:/home/user/public_html/include:./include') in /home/user/public_html/test.php on line 2

How could I receive this error when the include_path points to the location of myscript.php since the last two of the three areas specified in the include_path point to the same location of my include file?????

Thanks for any help.

-Shane

timgolding
08-09-2007, 05:23 PM
have you tired

./myscript.php

and

../myscript.php

TheShaner
08-09-2007, 05:34 PM
have you tired

./myscript.php

and

../myscript.php
The point of the include_path is so that you don't have to specify the location of your include relative to where your current running page is, thus no matter where I move my page on the server, it'll never error because it'll always find my include without changing the code.

So, using the include_path, it should search those locations for the file. It obviously did not or it would've found it since it's in 2 of the 3 the include_path search locations.

Your code doesn't change anything except that after searching the include_path, it'll search for it in the current directory (again) with your first suggestion and in your 2nd suggestion, it'll search for it in the directory above my public_html directory, which is outside my document root.

-Shane

CFMaBiSmAd
08-09-2007, 06:01 PM
The include_path is relative to the current working directory, which is not necessary the same as the current running script.

Also, what operating system? As the separator is different : or ; depending on operating system.

TheShaner
08-09-2007, 06:09 PM
The include_path is relative to the current working directory, which is not necessary the same as the current running script.
Correct.


Also, what operating system? As the separator is different : or ; depending on operating system.
Running Gentoo Linux and so I should be using the : separator.

Issue is resolved though. I didn't have execute permissions on the include folder :rolleyes:

Thanks for trying to help both of you.

-Shane



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum