I have a VPS account here at the planet using plesk and I'm trying to use opendir() and readdir() to read a directory outside of my httpdocs directory.
My httpdocs:
/var/www/vhosts/domain/httdocs
Where I'm trying to go:
/var/qmail/mailnames/domain/info/Maildir/new/
For a test, I'm just trying to back up a couple of directories and list the contents of:
/var/www/vhosts/
I've created a vhost.conf file in:
/var/www/vhosts/domain/conf
that has contained:
php_admin_flag engine on
php_admin_value open_basedir "/var"
or
php_admin_flag engine on
php_admin_value open_basedir /var
or
php_admin_flag engine on
php_admin_value open_basedir /
or
php_admin_flag engine on
php_admin_value open_basedir none
or
php_admin_flag engine on
php_admin_value open_basedir /var/www/vhosts
Hoping I would get access all the way back to /var
Then I run:
/usr/local/psa/admin/bin/websrvmng -a -v
/etc/rc.d/init.d/httpd restart
This is my script:
CODE
$dir = "../../../vhosts";
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
echo "filename: $file : filetype: " . filetype($dir . $file) . "\n";
}
closedir($dh);
}
}
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
echo "filename: $file : filetype: " . filetype($dir . $file) . "\n";
}
closedir($dh);
}
}
But each time I refresh the page, I get:
Warning: opendir(): open_basedir restriction in effect. File(../../../vhosts) is not within the allowed path(s)
What am I doing wrong? I've been at this for hours. The instructions I've found seem resonable but they don't work for me.
