Jump to content

Requiring file from root while in sub-domain


smc

Recommended Posts

Chronister's method will just cause more headache, never use include() or require() with urls

 

Dont forget you can use absolute paths with includes, or you can use the parent directory option (../)

 

You could do something like

 

include('/etc/apache2/php5/htdocs/myfile.php');

 

or you could just use the parent directory option with

 

include('../htdocs/myfile.php');

 

of course you would have to fine tune these to how your directories are set up.

Chronister's method will just cause more headache, never use include() or require() with urls

 

.......................

 

 

Why do you say this? I have not had any problems using include() even when using with URL's

 

Please explain, because if there is a good reason not to do this, then I want to know why

 

Thanks

Thank you

 

 

I did not realize that and to test it I tried to include a file that contains a connectdb() function that I made.

 

You are right, the included file is being parsed before it's included so I get a Call to undefined function error rather than it pulling the function in like I expected it to.

 

I learned something new here.... I love this forum

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.