Hello,
I am trying to require a file in a script that is located one directory back and in a separate folder, ie. "../lib/utility.php"
Each time I try to execute the php script w/ my browser, I am prompted w/ an error:
Warning: require_once(../lib/utility.php) [function.require-once]: failed to open stream: No such file or directory in C:\wamp\www\ah\data\registeration.php on line 8
Fatal error: require_once() [function.require]: Failed opening required '../lib/utility.php' (include_path='.;..;c:\wamp\php\include;c:\wamp\www\ah\lib') in C:\wamp\www\ah\data\registeration.php on line 8
The script I am trying to include is located int "C:\wamp\www\ah\lib"
I am running php on windows. I believe the include_path is set correctly. Does php not recognize the ".." notation?
I've hacked the script to ini_set() the exact location of the utility.php and require it directly, so I know its able to find the file.
Any help would be appreciated.
Thanks!
require_once( "../lib/utility.php" ) <- errors
Moderator: General Moderators
-
mechamecha
- Forum Commoner
- Posts: 32
- Joined: Thu May 31, 2007 8:49 pm
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
Are you trying to do this within a file that is included in another?
Also, you spelled "registration" wrong. n_n
Code: Select all
include dirname(__FILE__) . '/../lib/utility.php';-
mechamecha
- Forum Commoner
- Posts: 32
- Joined: Thu May 31, 2007 8:49 pm
nickvd, no I'm not doing that w/i the file that needs to be included in others. I tried adding it and php gave me a error stating it could not include that directory.
I messed w/ it some more and it looks as though php does not like me adding "." or ".." in my require_once paths.
example,
require_once( 'userinfo.php' ); // works
require_once( './userinfo.php' ); //doesn't work
require_once( '../data/userinfo.php') //doesn't work
userinfo.php is located in c:/wamp/www/ah/data
registration.php is located in c:/wamp/www/ah/data
What am I doing wrong?
Do I have incorrect settings in my php.ini file?
THanks
I messed w/ it some more and it looks as though php does not like me adding "." or ".." in my require_once paths.
example,
require_once( 'userinfo.php' ); // works
require_once( './userinfo.php' ); //doesn't work
require_once( '../data/userinfo.php') //doesn't work
userinfo.php is located in c:/wamp/www/ah/data
registration.php is located in c:/wamp/www/ah/data
What am I doing wrong?
Do I have incorrect settings in my php.ini file?
THanks
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm