So, I'm fairly confident that I need to add something to the allowed paths in the ini_set line in the code attached, but honestly, these kinds of settings are a weak point.... Anyway, I'm receiving this error in my logs when trying to access http://mydomain.com/companyb/pto/login.php:

PHP Warning: include() [<a href='function.include'>function.include</a>]: open_basedir restriction in effect. File(/companyb/includes/configs/startup.php) is not within the allowed path(s): (/var/www/vhosts/mydomain.com/httpdocs:/tmp:/usr/lib/php/Smarty:/usr/share/pear) in /var/www/vhosts/mydomain.com/httpdocs/companyb/pto/login.php on line 2, referer: http://mydomain.com/companyb/

And, I think I need to add something to the ini_set line in my startup config file (attached below... I'm not messing with php.ini directly). But, I tried changing it to:

ini_set('include_path', ABS_SERVER . $path_delimiter . ABS_SERVER . 'includes/' . $path_delimiter . ABS_SERVER . 'classes/' . $path_delimiter . ABS_SERVER . pto/' . $path_delimiter);

But that didn't seem to work. Help?

$path_delimiter = ":";

define('ABS_SERVER', '/var/www/vhosts/mydomain.com/httpdocs/companyb/');
ini_set('include_path', ABS_SERVER . $path_delimiter . ABS_SERVER . 'includes/' . $path_delimiter . ABS_SERVER . 'classes/' . $path_delimiter);

include_once('classes/class.session.php');

require( 'Smarty/libs/Smarty.class.php');
$smarty = new Smarty();
$smarty->template_dir = ABS_SERVER . 'smarty/templates';
$smarty->compile_dir = ABS_SERVER . 'smarty/templates_c';
$smarty->cache_dir = ABS_SERVER . 'smarty/cache';
$smarty->config_dir = ABS_SERVER . 'smarty/configs';

$session = new Session;
$smarty->assign('usersession', $session);

    You cannot override an open_basedir setting via an ini_set() command, or even by a .htaccess file setting; it can only be modified via the system settings (normally in php.ini, but possibly in httpd.conf if on Apache).

    However, from the error message it looks like the problem may be due to an incorrect path name. It appears you care trying to access a file as "/companyb/includes/configs/startup.php" which implies starting from the root directory "/", but I suspect what you want is "/var/www/vhosts/mydomain.com/httpdocs/companyb/includes/configs/startup.php" (or you could use your 'ABS_SERVER' constant for the first part of that path).

      Write a Reply...