Solved

Plesk, PHP and open_basedir

Posted on 2011-02-23
4
881 Views
Last Modified: 2012-05-11
I have a linux server with plesk, and I configured the main settings in the web interface. I know how to configure a webserver manually, but plesk is new to me.

The problem is that when i try to execute a php file, it answers me "500, internal server error".
In the virtualhost logs i can see


PHP Warning:  Unknown: open_basedir restriction in effect. File(/var/www/vhosts/websitedomain.com/httpdocs/index.php) is not within the allowed path(s): (/var/www/vhosts/websitedomain.com/httpdocs/:/tmp/) in Unknown on line 0

Open in new window



Note that the path specified is the right path, and my script is there. That the script doesn't include anything, I even tried with a ".php" file without any instructions. The error is the same.

I found the vhost files created by plesk in
/opt/psa/admin/conf/ip_vhosts_bootstrap.conf
that includes
/var/www/vhosts/websitedomain.com/conf/12984710050.82661300_httpd.include
and in this the complete virtualhost configuration, and the basedir setting.

I cannot modify them manually (as written at the top of the files), and i think that the right open_basedir should not be a problem for my website.

What's the problem? Any help appreciated!

Thanks
0
Comment
Question by:LAMASE
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 34961161
Any chance you have "safe mode?"
http://php.net/manual/en/features.safe-mode.php
0
 
LVL 4

Author Comment

by:LAMASE
ID: 34961192
Nope.
From the vhost file (/var/www/vhosts/websitedomain.com/conf/12984694820.65854400_httpd.include):

php_admin_flag safe_mode off
php_admin_value open_basedir /var/www/vhosts/websitedomain.com/httpdocs/:/tmp/

Open in new window


I also searched the whole filesystem for safe_mode and never found it "on"
0
 
LVL 4

Accepted Solution

by:
LAMASE earned 0 total points
ID: 34979559
I had to solve by myself: i created a file called
/var/www/vhosts/websitedomain.com/conf/vhost.conf

Open in new window

that overwrites open_basedir directive:

Content of the file:
<Directory /var/www/vhosts/websitedomain.com/httpdocs/>
php_admin_value open_basedir none
</Directory>

Open in new window


Don't know why the right open_basedir didn't work. Not time to think to this at the moment... but now it works.
0
 
LVL 4

Author Closing Comment

by:LAMASE
ID: 35015390
Solved by myself, not in the clean way but the quick one.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question