Page 1 of 1

Code Errror

Posted: Sat May 22, 2004 3:24 pm
by John Cartwright
I wrote this code for a guy awhile back and decided to put it into use for myself, but now I'm butting some errors taht I don't understand.

Code: Select all

Warning: opendir(): open_basedir restriction in effect. File(/images/JC/thumbs/) is not within the allowed path(s): (/home/runtings:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/runtings/public_html/imagehandler.php on line 7

Warning: opendir(/images/JC/thumbs/): failed to open dir: Operation not permitted in /home/runtings/public_html/imagehandler.php on line 7
The files are there im images/JC and images/

The code is

Code: Select all

<?php
<?

$i=1; 
$dir = "/images/JC/thumbs/"; // thumbs (duh) 
$bigdir = "/images/JC"; // originalsized, using same names as thumbs 
echo '<table>'; 
if ($handle = opendir($dir)) { 
    while (false !== ($file = readdir($handle))) { 
        if ($file != "." && $file != "..") { 
         $i++; 
         // opens row and column is remainder is odd else open column 
             if ($i%2=='1'){ echo '<tr><td>'; }else{ echo '<td>'; } 
            echo "<a href="$bigdir/$file"><img src="$dir/$file" border="1"></a>"; 
          // closes row and column is remainder is odd else close column 
             if ($i%2=='1'){ echo '</td></tr>'; }else{ echo '</td>'; } 
       } 
    } 
    echo '</table>'; 
    closedir($handle); 
} 

?>
?>
Help plz

Posted: Sat May 22, 2004 3:54 pm
by Weirdan
check your php.ini config file for open_basedir entry. There listed all directory trees you're allowed to access from within php script. By 'directory tree' I mean 'directory and all of its subdirectories', for example adding /images/ to the list of allowed dirs would allow you to manipulate the files in /images/JC/ as well.