Include only works in current Dir
Posted 17 March 2006 - 06:45 PM
I'm using Ensim on Fedora and one of my sites isn't allowing me to include from a folder other than the one the current php script is in.
include 'file.php'; //works
include 'directory/file.php'; //doesn't work
include(getenv('DOCUMENT_ROOT').'/directory/file.php'); // doesn't work
Posted 17 March 2006 - 07:26 PM
if your file is in the public_html folder and you want to get file newscript.php in the secondfold then it would be
include('secondfold/newscript.php');notice no starting slash, you only start the slash if you are doing absolute path
lets say you are in the secondfold folder and want to reference a file in the base folder(public_html)
include('../myfile.php');the ../ will go back one level and work from there
hope that helps
Posted 17 March 2006 - 07:51 PM
Posted 17 March 2006 - 09:54 PM
I try to keep all my links reletive, and I'm still having an issue with my current script. I thought there must be some php setting or apache permissions that may be out of wack, but after building a simple test script, everything works just the way you guys explained.
I don't understand why my script refuses to work.. ill have a drink and start again.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users