Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 524
  • Last Modified:

Trouble with open_basedir

Usually I like to set MySQL connection info away from root
on my server it has always worked fine.
on the same server with PLESK and a new dedicated IP I did set up a new site (named here example.com!)
but it keeps rejecting my include tentative
I need to access from root to
/var/www/vhosts/example.com

As is:
In php.ini open basedir is commented
there is no ref to open basedir in httppd
I have all access, SSH etc..

what could I do? How can I make it going through?
Error received:
Warning: include() [function.include]: open_basedir restriction in effect.
File(/var/www/vhosts/example.com/test2.php) is not within the allowed path(s): (/var/www/vhosts/example.com/httpdocs/:/tmp/) in /var/www/vhosts/example.com/httpdocs/test.php on line 2

I simplified the include for testing, instead I use:
ini_set('include_path', 
 realpath($_SERVER['DOCUMENT_ROOT'] . '/../inc_support/') 
 . PATH_SEPARATOR
 . ini_get ('include_path'));
 
 include("conn.inc.php");

Open in new window

0
array007
Asked:
array007
  • 3
  • 2
2 Solutions
 
g3nu1n3Commented:
This should resolve your issue. Be sure to backup any files that you are editing.

1. Add file vhost.conf to /var/www/vhosts/YOURDOMAIN/conf folder with the following:

<Directory /var/www/vhosts/YOURDOMAIN/httpdocs/>
<IfModule sapi_apache2.c>
php_admin_value open_basedir none
</IfModule>
<IfModule mod_php5.c>
php_admin_value open_basedir none
</IfModule>
</Directory>

Open in new window


2. Reload server configuration, either via Plesk admin or through CLI:

/usr/local/psa/admin/sbin/websrvmng -u --vhost-name=yourdomain

Open in new window

0
 
Ray PaseurCommented:
I use this statement:

require_once('../uproot/common.php');

The "uproot" directory is on my server in a parallel universe with the "www" directory that holds the web root.  In my phpinfo() display, open_basedir says "no value."  The behavior of this directive has been changed recently.
http://us3.php.net/manual/en/ini.core.php#ini.open-basedir
0
 
array007Author Commented:
Hi Ray,
my info reads:
/var/www/vhosts/example.com/httpdocs/:/tmp/
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
Ray PaseurCommented:
Curious... Who is your hosting company?

Have you tried the suggestion from g3nu1n3?  It looks pretty much right to me.
0
 
array007Author Commented:
I am with JaguarPC
Yes, I will later try vhosts conf mods

Henry
0
 
Ray PaseurCommented:
I couldn't find any really strong recommendations when I searched for reviews of JaguarPC, and certainly the strength of tech support is, to my mind, the greatest differentiating factor in choosing a web host.  If you're not "married" to JaguarPC you might consider a different hosting company (in case our suggestions do not get things fixed up for you).  I use and am pleased to recommend ChiHost.com for their excellent support.  I have also had good experiences with Hostgator and LiquidWeb.  Some of my colleagues recommend ServerGrove for PHP hosting.  I do not recommend GoDaddy or SiteGround because I have had poor experiences with their technical support.

In any case, best of luck with it! ~Ray
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now