swatisonee Posted November 25, 2010 Share Posted November 25, 2010 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 Quote Link to comment Share on other sites More sharing options...
aabid Posted November 25, 2010 Share Posted November 25, 2010 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. Quote Link to comment Share on other sites More sharing options...
swatisonee Posted November 25, 2010 Author Share Posted November 25, 2010 gosh thanks ! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.