Jump to content

Peculiar issue with include


swatisonee

Recommended Posts

Hi:

 

1.I have some scripts in  a dir of my root directory that i wanted to move to a subdir in it .

 

2.So i created a dir "Set1" and moved them there.

 

3.Now each of these files has an include at the top which contains db info and another which contains session info etc).

 

4.After redirecting to the new location I modified the include as under and got errors - as listed below.

 

5.It appears that when a script in the new location is to be processed, it cannot find the db info.

 

6.It searches for the db info in the subdir and not in the main dir.

 

I tried fiddling with the ../ stuff but havent succeeded. Any pointers please ?

 

Many thanks:Swati

=========================

 

/www/NEW contains

 

connectionlink.php

loglink.php

 

 

/www/NEW/Set1 contains

 

hr.php

 

The header of hr.php is as under :

 

<?
header("Cache-Control: public");

include ("../NEW/connectionlink.php"); //db info 
include ("../NEW/loglink.php"); //loginfo

?>

 

Errors that come up are as under.  Lines 5, 6 of hr.php have the include statements:

 

Warning: include(../NEW/connectionlink.php) [function.include]: failed to open stream: No such file or directory in /home/tern/public_html/NEW/Set1/hr.php on line 5

Warning: include(../NEW/connectionlink.php) [function.include]: failed to open stream: No such file or directory in /home/tern/public_html/NEW/Set1/hr.php on line 5

Warning: include() [function.include]: Failed opening '../NEW/connectionlink.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/tern/public_html/NEW/Set1/hr.php on line 5

Warning: include(../NEW/loglink.php) [function.include]: failed to open stream: No such file or directory in /home/tern/public_html/NEW/Set1/hr.php on line 6

Warning: include(../NEW/loglink.php) [function.include]: failed to open stream: No such file or directory in /home/tern/public_html/NEW/Set1/hr.php  on line 6

Warning: include() [function.include]: Failed opening '../NEW/loglink.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/tern/public_html/NEW/Set1/hr.php on line 6
Sorry, Please login and use this page 

Link to comment
Share on other sites

You can set default include directory for your script only with this,

ini_set("include_path","/www/NEW");

 

Put this code just and then after include the files,

This will set /www/NEW as a default include directory where PHP will go to check those included files.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.