Jump to content


Photo

include files in php


  • Please log in to reply
1 reply to this topic

#1 test006

test006
  • Members
  • PipPip
  • Member
  • 11 posts

Posted 29 April 2006 - 07:05 AM

Hi,
I have read the following tutorial Including Files in PHP - Beginner Tutorial and i still have some questions. I came across this when working on my current project.
I have all my php files under following directory:
/var/www/test/code
So all my php scripts are under code directory as shown above....
No i want to include files within my php scripts that are from a directory that is not inside /var/www directory.
I want to have a include directory that inside /var directory so my include directory is /var/include.

My question is how do i include files in my script that are located in a directory that is outside the /var/www directory as in my case this is /var/include directory...

Do i need to enable read permissions for my web server to be able to read files from /var/include directory??

Please advise...

Thanks for help in advance..


#2 jarsky

jarsky
  • New Members
  • Pip
  • Newbie
  • 9 posts

Posted 29 April 2006 - 07:47 AM

nope you dont, easiest way to do it would be to change

include("file.inc.php");

to

include("../../include/file.inc.php");

for every ../ you add it will jump back 1 directory :)
[a href="http://www.ravestyles.com" target="_blank"] [/a]




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users