[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Plesk, PHP and open_basedir

Posted on 2011-02-23
4
Medium Priority
?
884 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 111

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

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
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 look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

656 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