Brain block with require

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Brain block with require

Post by JayBird »

having a brainblock with require

i have a directory structure like this

Code: Select all

root
|_includes <dir>
| |_onlineusers.php
| |_config.php
|_index.php
in index, i require onlineusers.php, no problem there. But in onlineusers.php, i need to require config.php but i just cant get it to work!

i thought in onlineusers.php i would just need to do

Code: Select all

require ("config.php");
Mark
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Hmm..yeah. If you can require onlineusers.php from index.php then it sounds like the includes directory is in your include_path, which means you should be able to require config.php from onlineusers.php as you suggested, ...weird.
User avatar
Wayne
Forum Contributor
Posts: 339
Joined: Wed Jun 05, 2002 10:59 am

Post by Wayne »

as Mark said sounds weird ... should work?!
if none of these work ...

Code: Select all

require ("config.php");
require ("includes/config.php");
require ("full/path/to/includes/config.php");
then are you sure the perms on the files are correct?
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

Sorted.

I had changed some code in index.php, but not re-uploaded it....DOH!!!

1 hour wasted :)

Mark
Post Reply