open_basedir restriction in effect error in PHP
by Rekha[ Edit ] 2008-03-19 17:17:04
Hi
This must be one of the most annoying errors to get when working with php. This error occurs when PHP can't find the specified file in the include statement. This often occurs when a developer has built an application on their machine and uploaded the application to a shared hosting account or if they move the application to a sub folder.
An easy work around is to determine the path to the called file dynamically.
<?php
$f = substr_count($_SERVER["PHP_SELF"], "/");
$f1 = "";
if($f > 1) {
for($i=2;$i<=$f;$i++) {
$f1 .= "./";
}
} else {
$f1 = "";
}
$incfile = $f1."submit.php";
$incfile1 = $f1."time.php";
include $incfile;
include $incfile1;
..............remaining code follows..
?>