Including a file on a public server

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
StumpDK
Forum Commoner
Posts: 35
Joined: Thu Feb 12, 2004 2:28 am
Location: Copenhagen, Denmark

Including a file on a public server

Post by StumpDK »

Hi!
I have uploaded my site to lets say, http://www.myserver.com. As I tested the site on my own computer, the site worked perfectly, but because of the new adress, none of the included files can be found.
The error:

Warning: main(smarty/libs/smarty_setup.php): failed to open stream: No such file or directory in /usr/local/psa/home/vhosts/myserver.com/httpdocs/main/main.php on line 2

The file returning the error is placed in myserver.com/httpdocs/classes.

The problem, as I see it is, that the file which is including the smarty-file, is placed in a directory a level under the directory in which the including file is placed. Or am I wrong?

Now, how can I included the missing file? I've tried the '/' in the main-file, but I get a error saying that the action is beyond my restrictions...?
tsg
Forum Contributor
Posts: 142
Joined: Sun Jan 12, 2003 9:22 pm
Location: SE, Alabama
Contact:

Post by tsg »

The include files need to be the path on your server. Your path is probably something like

/home/user/public_html

or something like that. And the included files need to be using that path.

Create a test php page and type this:

Code: Select all

<?php
print $DOCUMENT_ROOT;

?>
Upload it. That should give you your path.

Tim
Post Reply