"fopen(): Open_basedir Restriction In Effect" Error

I'm writing a PHP script that will read the files in a particular folder, then make individual php files for each image file (each php file will be a page that contains an image). The master script will be located under /home/[username]/public_html/events/template/ , and the individual pages and images will be contained in /home/[username]/public_html/events/$eventname/ (where $eventname is some word to describe an event). In this case, I set $eventname to "test".<br /><br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->// $eventname and $folder are defined previously and $username is my Cpanel username<br />$text = "/home/{$username}/public_html/events/{$eventname}intro.html";<br />$eventfile = file($text);<br /><br />$dir = "/home/{$username}/public_html/events/{$eventname}/";<br />$dh = opendir($dir);<br />while (($file = readdir($dh)) !== false) {<br />  if ($file != "." && $file != "..") {<br />    $file = substr($file,0,strlen($file)-4);<br />    $files[] = $file;<br />  }<br />}<br />closedir($dh);<br />$numfiles = count($files)-2;<br /><br />for ($i=0; $i < numfiles; $i++) {<br />  $file = fopen("/home/{$username}/public_html/events/{$eventname}/{${files}[$i]}.php", "x");   ///LINE 34<!--c2--></div><!--ec2--><br /><br />I receive the following error (again, I removed my Cpanel username):<br /><!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><b>Warning</b>:  fopen(): open_basedir restriction in effect. File(/home/[username]/public_html/events/test/img_1646-01_std.php) is not within the allowed path(s): (/home2/[username]/:/usr/local/sqmail/:/usr/lib/php:/usr/local/lib/php:/tmp) in <b>/home2/[username]/public_html/events/template/makepicpages.php</b> on line <b>34</b><br /><!--c2--></div><!--ec2--><br /><br />Any help?<!--content-->
Try replacing home with home2.<br />I see that from the path to your script:<br />/home2/[username]/public_html/events/template/makepicpages.php<!--content-->
 
Back
Top