inclusion doing my head in!!!

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
TuffGong
Forum Newbie
Posts: 5
Joined: Wed Jun 12, 2002 6:00 am

inclusion doing my head in!!!

Post by TuffGong »

i've had this problem for some time now, but some background information first:

two directories:

directory :

Code: Select all

directory : [Messages]

[Messages] contains PHP files
[HTML] contains HTML file + 1 PHP file (Home.PHP)

Home.php contains two lines which tries to include files in [Messages]

include "../messages/file1.php";
include "../messages/file2.php";

this works perfectly on my windows Apache but once uploaded to my server it says it failed to include it! .. any ideas why????

M
User avatar
James Pelow
Site Admin
Posts: 51
Joined: Sat Jun 01, 2002 5:28 am
Location: Killiney, Co. Dublin, Ireland
Contact:

Moo

Post by James Pelow »

It should work - but it's really safer to add the full path on *nix. You probably know what that is but if not - it's the path from the base dir. For example on Mac OS X the path is /Library/WebServer/Documents

-James
User avatar
hob_goblin
Forum Regular
Posts: 978
Joined: Sun Apr 28, 2002 9:53 pm
Contact:

Post by hob_goblin »

maybe your include path is set wrong? try not putting the ".."
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

It's probably because *nix is case-sensitive and Windows isn't so either make your directories all lower-case or change this:

Code: Select all

include "../messages/file1.php"; 
include "../messages/file2.php";
to this:

Code: Select all

include "../Messages/file1.php"; 
include "../Messages/file2.php";
Keeping all file names and directory names lower case is a good idea when you'll be testing on a Windows machine and uploading to a *nix one as it means less issues with case sensitivity.

Mac
TuffGong
Forum Newbie
Posts: 5
Joined: Wed Jun 12, 2002 6:00 am

tried all the above

Post by TuffGong »

but to no availo, i have another solution in mind, iw ill jus try that :-( .. probably some bug on my server or something
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Does your host have it set up so that you can only access files in the HTML directory?

Mac
Post Reply