View Full Version : open_basedir restriction in effect
btimms
03-17-2008, 08:48 AM
Hi,
I'm getting an error on a script I'm trying to install. I think I've run into this before after installing PHP 5 - but not sure how to fix it.
Any suggestions appreciated.
Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/home/youradmin/www/phpsupercart/license.php) is not within the allowed path(s): (/home/mydomain:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/mydomain/public_html/phpsupercart/includes/functions.inc.php on line 295
cannot load /home/youradmin/www/phpsupercart/template/site/Template2/index.phpcannot load /home/youradmin/www/phpsupercart/template/misc/categorynotactive.php
jason
03-17-2008, 09:30 AM
That message means that in your PHP configuration (/etc/php.ini most likely) you have openbasedir turned on. This setting prevents scripts from reading files (via requires, includes, any of the file handing functions, etc.) from directories that are not marked as "safe." It was designed to prevent users from accessing sensitive files and/or other user's files shared servers while PHP was running as "nobody."
Openbasedir directives are set via the open_basedir directive in php.ini or with php_admin_value directives in the Apache configuration. They are commonly set in individual <VirtualHost> directives in the Apache conf (often /etc/httpd/conf/httpd.conf or /etc/httpd/conf.d/domain.conf) specific to indivdual domains. The value consists of a list of paths from which PHP is allowed to access files, separated by colons (semicolons in Windows).
Your options:
1.) Add the directories you need to access via the Apache conf for the specific domain.
2.) Modify php.ini for the entire server to allow access to sp[ecific locations for all users (values in the Apache conf will override this setting, however).
3.) Turn off open_basedir in php.ini by commenting out the line in php.ini (not recommended unless you are the only user of the server).
4.) Switch to the CGI version of PHP using suPHP (http://www.suphp.org/Home.html) if your environment supports it. With suPHP all PHP scripts run under their owner's user id, so the script has access to all of the files the owner can access an nothing else, negating the need (in most cases) for using open_basedir.
Be careful when changing any server configuration options, however. Often your control panel software, if you are using any, will overwrite changes you make when it updates, so consult with your control panel's documentation or support for the best way to make such changes.
--Jason
btimms
03-17-2008, 09:36 AM
Thanks Jason. You are a wealth of knowledge.
Actually, I found an option in cPanel that turns it off.
Bob
Powered by vBulletin™ Version 4.0.6 Copyright © 2010 vBulletin Solutions, Inc. All rights reserved.