Ginja_Ninja Posted July 2, 2005 Posted July 2, 2005 Hi, I have created my website around php and it all works/worked fine, untill i decided it was a good idea to move my file containing my databse password and connections settings to **** instead of it residing in ****/html_public Naturally i changed all my other files that refereced this file. eg files that reside in html_public had include 'myconnections.php'; became include '../myconnections.php' and for the most part it works fine, but i have really big issue with a file that references it in html_public/exampledir/ with include '../../myconnections.php' it just does like it , i dont get the usual, cant find it error, i get Warning: main(): open_basedir restriction in effect. File(../../../myconnections.php) is not within the allowed path(s): (/home/MYUSERNAME:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/ypgympj/public_html/exampledir/checks.php on line 4 ive been told its something todo with the configuration, but this is were i need your help. What do i do from here Thoughts much appreciated. Take Care G_N Quote
TCH-Don Posted July 2, 2005 Posted July 2, 2005 You can use include $_SERVER['DOCUMENT_ROOT']."/myconnections.php'"; or if in a folder inside public_html include $_SERVER['DOCUMENT_ROOT']."/folder/myconnections.php'"; Quote
Ginja_Ninja Posted July 3, 2005 Author Posted July 3, 2005 i can still use that if myconnections reside in the the folder above public_html ??? the folder that lists: etc mail public_html public_ftp tmp myconnections.php this is were i am trying to put my connections file as i thought it would be the safest thanks G_N Quote
Ginja_Ninja Posted July 3, 2005 Author Posted July 3, 2005 i think i figured it out stand down, men.... lemme play a sec. G_N Quote
TweezerMan Posted July 3, 2005 Posted July 3, 2005 Your example is basically a script located here: /home/cpanelName/public_html/exampledir/myscript.php ...with include '../../myconnections.php' The error message is indicating that your script is looking for myconnections three directories above your script, not two: Warning: main(): open_basedir restriction in effect. File(../../../myconnections.php) is not within the allowed path(s): Three directories above /home/cpanelName/public_html/exampledir is the /home directory, which outside of PHP's open_basedir() restrictions, not to mention that /home is a directory that you don't have permission to access nor should be trying to access. You need to locate the line in your script that is trying to include the myconnections.php file by going up 3 directories and change it so that it is only going up 2 directories, like what you posted in your "example". Quote
Ginja_Ninja Posted July 3, 2005 Author Posted July 3, 2005 I sorted it now, thank you all for your brain powers Much appreciated.. Take Care G_N Quote
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.