Hi, <br /><br />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<br /><br />****<br />instead of it residing in ****/html_public<br /><br />Naturally i changed all my other files that refereced this file.<br /><br />eg files that reside in html_public had<br /><br />include 'myconnections.php'; became include '../myconnections.php'<br /><br />and for the most part it works fine, but i have really big issue with a file that references it in<br /><br />html_public/exampledir/ with include '../../myconnections.php'<br /><br />it just does like it , i dont get the usual, cant find it error, i get <br /><br />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<br /><br />ive been told its something todo with the configuration, but this is were i need your help. What do i do from here<br />Thoughts much appreciated.<br /><br />Take Care<br />G_N<!--content-->
You can use <br /><br /><b>include $_SERVER['DOCUMENT_ROOT']."/myconnections.php'"; </b><br /><br />or if in a folder inside public_html<br /><br /><b>include $_SERVER['DOCUMENT_ROOT']."/folder/myconnections.php'"; </b><!--content-->
i can still use that if myconnections reside in the the folder above public_html ??? <br /><br />the folder that lists:<br />etc<br />mail<br />public_html<br />public_ftp<br />tmp<br />myconnections.php<br /><br />this is were i am trying to put my connections file as i thought it would be the safest<br />thanks<br /><br />G_N<!--content-->
i think i figured it out<br /><br />stand down, men....<br /><br />lemme play a sec.<br /><br />G_N<!--content-->
Your example is basically a script located here:<br />/home/cpanelName/public_html/exampledir/myscript.php<br />...with include '../../myconnections.php'<br /><br />The error message is indicating that your script is looking for myconnections <b>three</b> directories above your script, not two:<br /><!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec-->Warning: main(): open_basedir restriction in effect. <b>File(../../../myconnections.php)</b> is not within the allowed path(s):<!--QuoteEnd--></div><!--QuoteEEnd--><br />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.<br /><br />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".<!--content-->
I sorted it now, thank you all for your brain powers<br /><br />Much appreciated..<br /><br />Take Care<br /><br />G_N<!--content-->
You can use <br /><br /><b>include $_SERVER['DOCUMENT_ROOT']."/myconnections.php'"; </b><br /><br />or if in a folder inside public_html<br /><br /><b>include $_SERVER['DOCUMENT_ROOT']."/folder/myconnections.php'"; </b><!--content-->
i can still use that if myconnections reside in the the folder above public_html ??? <br /><br />the folder that lists:<br />etc<br />mail<br />public_html<br />public_ftp<br />tmp<br />myconnections.php<br /><br />this is were i am trying to put my connections file as i thought it would be the safest<br />thanks<br /><br />G_N<!--content-->
i think i figured it out<br /><br />stand down, men....<br /><br />lemme play a sec.<br /><br />G_N<!--content-->
Your example is basically a script located here:<br />/home/cpanelName/public_html/exampledir/myscript.php<br />...with include '../../myconnections.php'<br /><br />The error message is indicating that your script is looking for myconnections <b>three</b> directories above your script, not two:<br /><!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec-->Warning: main(): open_basedir restriction in effect. <b>File(../../../myconnections.php)</b> is not within the allowed path(s):<!--QuoteEnd--></div><!--QuoteEEnd--><br />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.<br /><br />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".<!--content-->
I sorted it now, thank you all for your brain powers<br /><br />Much appreciated..<br /><br />Take Care<br /><br />G_N<!--content-->