Confirm Paths page error: Warning: file_exists(): open_basedir restriction in effect

Confirm Paths page error: Warning: file_exists(): open_basedir restriction in effect

by Dave Johnston -
Number of replies: 7

I am installing Moodle 2.3 on the following setup:

- 1and1.com hosting dynamic cloud server

- CentOS 6.2 with Parallels Plesk 10.4

I have full root access, have setup mydomain.com as a subscription in Plesk control panel, so:

the site on the server is at /var/www/vhosts/mydomain.com

the Moodle install is at /var/www/vhosts/mydomain.com/httpdocs/moodle

the Moodle data directory is at /var/www/vhosts/mydomain.com/moodledata

 

First, I had an issue changing the directory permissions for /var/www/vhosts/mydomain.com from 755 to 777, but was able to call 1and1 server support and they changed it to 777 for me from ssh root with chmod -r 0777. I am assuming once I get the Moodle install complete, I will need to call 1and1 server support back and have them changed to /var/www/vhosts/mydomain.com permissions back to 755 since I don't seem to have permissions to change it.

Second, I am getting the following error at the top of the page during install (from both ssh and web browser install options) on the Confirm paths page:

Warning: file_exists(): open_basedir restriction in effect.
File(/var/www/vhosts/mydomain.com/moodledata) is not within the allowed path(s):
(/var/www/vhosts/mydomain.com/httpdocs/moodle/:/tmp/) in
/var/www/vhosts/mydomain.com/httpdocs/moodle/install.php on line 309 Warning:
is_writable(): open_basedir restriction in effect.
File(/var/www/vhosts/mydomain.com) is not within the allowed path(s):
(/var/www/vhosts/mydomain.com/httpdocs/moodle/:/tmp/) in
/var/www/vhosts/mydomain.com/httpdocs/moodle/install.php on line 313

At the bottom of the page below the line:

Data directory: /var/www/vhosts/mydomain.com/moodledata

Parent directory (/var/www/vhosts/mydomain.com) is not writeable. Data directory (/var/www/vhosts/mydomain.com/moodledata) cannot be created by the installer.
 
So, here are two questions:
 
1) Is there a way to bypass this directory creation step (with using either the SSH or web install process) since I can create the directory myself outside of the Moodle install?
 
OR,
 
2) Can someone provide step-by-step instructions to change the php settings to get past the open_basedir restriction? I do have full root access but would need some pretty clear directions to be able to do this myself.
 
I have looked at http://moodle.org/mod/forum/discuss.php?d=154109 and the final post seems to provide a solution but does not provide details:

Hello, I had the same problem with almost the same setup. centos server and plesk control panel. I was able so solve the problem by adding the moodle data path to the open_basedir line in the php.ini file of the domain.

Thanks in advance for any help.

 

 

Average of ratings: -
In reply to Dave Johnston

Re: Confirm Paths page error: Warning: file_exists(): open_basedir restriction in effect

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Dave,

One thing you can do to make life easier for yourself is to get a copy of WinSCP. It is a free SFTP client for Windows that will let you make those permission changes yourself. (I'm presuming <dangerously, I know wide eyes> that you are using Windows.) You set WinSCP to log into your 1and1 domain using the "first' ftp user name and password they give you for your account. Set the protocol to SFTP.

When WinSCP logs in to your 1and1 domain, it gives you two windows. The left is files/folders on your local computer and the right window is the file/folders of your 1and1 domain. Copying files, in either direction, is a simple drag and drop. Changing permisions for owner, group and others is a simple right click then set some checkmarks for read, write, execute, and then click ok. There is even a check mark box to let it recursively change the permissions to everything inside the folder you're setting. A real time saver since there are over 12,000 files in the current Moodle 2.3. thoughtful

If you install Putty (a free telnet/ssh client) and set WinSCP > Options > Preferences > Integration > Applications  External applications, to point to putty.exe, you can even open a terminal window to your account. Thats how I know my 1and1 account is on Debian GNU/Linux and the hard drive (it's a big one) they have me on is 80% full. sad

Oops, gotta go...pizza is ready,

HTH

AL

In reply to AL Rachels

Re: Confirm Paths page error: Warning: file_exists(): open_basedir restriction in effect

by Dave Johnston -

I am running a CentOS server (unix/linux variant) with Paralells Plesk (so a vhost environment), using FileZilla for FTP client and putty for ssh. I have already changed to file permissions, as I noted, but am still getting the error because of the open_basedir restriction. I either need to be able to skip the create moodledata dir process during install, or correct the open_basedir restriction error, which I need better direction to accomplish.

In reply to Dave Johnston

Re: Confirm Paths page error: Warning: file_exists(): open_basedir restriction in effect

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

The moodledata directory can actually be almost anywhere...you just have to make sure things point/refer to it as needed. For instance when you run the moodle install.php that is one of the things you will have to enter is where the data directory is physically located. For instance, one of mine at 1and1 is:

$CFG->dataroot  = '/homepages/xxanumberxx/xxanothernumberxx/htdocs/moodledata20';

Unfortunately, I set up my 1and1 account so long ago, I forget how I found out what the number were and a quick look through their faq just now does not jog my memory.

Just found it... FAQ > Scripting and Programming Languages > Link next to a blue square at bottom of the list. Basically, when you log in to 1and, Click the Domains link from the Domains & Webspace panel, Check the box next to one of your domains and then click the Info button. What you are looking for is the complete web server path in the pop up window.

HTH,

AL

In reply to Dave Johnston

Re: Confirm Paths page error: Warning: file_exists(): open_basedir restriction in effect

by Dave Johnston -

Ok, I think I found the solution at:

http://www.bigsoft.co.uk/blog/index.php/2007/12/30/fixing-php-s-require-open_basedir-restri

It looks very similar to my issue but I have not tried it yet ...

In reply to Dave Johnston

Re: Confirm Paths page error: Warning: file_exists(): open_basedir restriction in effect

by Dave Johnston -

Ok, so I followed the creation of the vhost.conf file in the mydomain.com/conf directory as follows:

<Directory /var/www/vhosts/mydomain.com/httpdocs>
 <IfModule sapi_apache2.c>
  php_admin_flag engine on
  php_admin_flag safe_mode on
  php_admin_value open_basedir "/var/www/vhosts/mydomain.com/httpdocs:.:/php:/tmp"
 </IfModule>
 <IfModule mod_php5.c>
  php_admin_flag engine on
  php_admin_flag safe_mode on
  php_admin_value open_basedir "/var/www/vhosts/mydomain.com/httpdocs:.:/php:/tmp"
 </IfModule>
</Directory>

Also tried it with the following Line 1 (not sure if the code is correct here):

<Directory php_admin_flag safe_mode off /var/www/vhosts/mydomain.com/httpdocs>

Neither option changed a thing ... the server did create a file in /conf directory titled .vhost.conf.swp ... not sure what that is.

I am wondering if on line 5 and 10 I need to add /moodledata in the php_admin_value somewhere. I am now a bit lost here and wondering if there is another file I may need to modify.

Suggestions/ideas would be great ... just remember I am on a virtual host cloud server, I have root access and I am only hosting my own website in the /vhost directory.

thanks in advance

In reply to Dave Johnston

Re: Confirm Paths page error: Warning: file_exists(): open_basedir restriction in effect

by Dave Johnston -

After doing a lot of reading, it seems my problem is the PHP settings in Plesk. I found a great, previous posting which explained the solution (go to the very bottom of the thread for the simple solution):

http://moodle.org/mod/forum/discuss.php?d=96069

and make sure you understand the PHP settings in Plesk:

http://download1.parallels.com/Plesk/PP10/10.4/Doc/en-US/online/plesk-administrator-guide/index.htm?fileName=69526.htm

It seems like a VERY simple solution .. but alas ... it still does NOT work and I get the same error. Note ... I did go back and delete the vhosts.conf file I had created and restarted my web server.

Any other thoughts about what could be causing this error or how to deal with it?

Thanks in advance!

 

In reply to Dave Johnston

Re: Confirm Paths page error: Warning: file_exists(): open_basedir restriction in effect

by Dave Johnston -

OK ... so hopefully ("fingers crossed") this is my final post on this dreaded topic. I will start by saying ... I got past the "open_basedir restriction in effect" error successfully (still have not finished the install but am hoping the rest will go smoothly. I have spent 3 days (maybe 4 or 5 days ... it is all a blur at this point) with what seems to be a simple problem. My final solution was simple, but it does not make sense way this last step was required according to the Plesk Admin user guide link I posted previously.

First, if you are new to Plesk, make sure you understand the difference between Service Plan, Subscription and Customer (I am assuming you are logging into the Admin side of Plesk, and that you are NOT logging in as a customer in the customer control panel). If you are using a 1and1 virtual host setup, by default there is a Custom Service Plan tied to the "no name" domain name 1and1 gives you by default (e.g.,  us1234.dynamiccloudserver.info (Custom)). This Custom Service Plan can not be adjusted.

You need to create a new service plan and, if you are the only one hosting websites on your server (i.e., you are not reselling hosting packages), just give this Service Plan unlimited everything (well, at least that is what I did ... figure it did not matter).

If you did not already do so, add yourdomain.com to a subscription by going to Hosting Services>Subscriptions>Add New Subscriptions ... the page should say Adding Own Subscription. On this page, you can select the Service Plan you already created (not the Custom plan that can not be changed).

If you already had added yourdomain.com to a subscription, go to Hosting Services>Domains, click on yourdomain.com, then click on the Change Plan button. Select the plan on the New Service Plan dropdown menu and click OK.

Now that you hopefully have the correct Service Plan attached to yourdomain.com Subscription, you can do what was already stated above with the custom PHP settings in the Plesk control panel.

So here was my final problem and how I fixed it. First, being logged in under Plesk Admin control panel, go to Hosting Services>Service Plan>Hosting Plan (tab), under the Plan Name header, click on the name of the Service Plan you created earlier. Now you should be at Home > Service Plans > Editing MyServicePlanName. Click on the PHP Settings tab. Under the Perfomance Settings, go down to "open_basedir", click on Enter Custom Value buble and enter /var/www/vhosts/yourdomain.com/httpdocs/:/var/www/vhosts/yourdomain.com/moodledata:/tmp:/proc:/usr/bin . Click on the Update & Sync button at the bottom of the page. At this point, I restarted my web service under Service Management>Tools & Settings>Services Management by clicking on the orange icon to the far right on the Web Server (Apache) line. This still did not fix the problem for me.

I then went to Hosting Services>Subscriptions and clicked on the Open in Control Panel on the far right of the mydomain.com line. Once into the mydomain.com control panel (you are now logged in as yourdomain.com subscription the Service Plan, instead of the overall hosting admin), click on the Websites and Domains tab. Now go down toward the bottom of the page under the Domain header, and click on mydomain.com.

You should now be on a page titled Hosting Settings for YourDomain.com. If you setup the Service Plan and Subscription correctly, you should have (at least) two tabs: General and PHP Settings. Click on the PHP Settings tab. As before, scroll down to "open_basedir" and click on Enter Custom Value bubble and enter the same /var/www/vhosts/yourdomain.com/httpdocs/:/var/www/vhosts/yourdomain.com/moodledata:/tmp:/proc:/usr/bin and click OK button at the bottom of the page. I also had a subdomain I was using to point at my /moodle directory, so had added it as a subdomain in MyDomain.com Subscription, and followed the same steps to Enter Custom Value for open_basedir in PHP Settings (just for good measure).

Finally, I got the install to work. Not knowing Plesk that well, maybe I could have just done the settings in the MyDomain.com Plesk control panel, but I did it in all of them. After reading the Plesk Admin User Guide I linked in the previous post, it seems to me that changing this setting only in the Plesk Admin login should have resulted in it working correctly, but it was not until I did it in the specific MyDomain.com PHP Settings, did it work.

Good luck and hopefully you don't hear from me on this issue again!! smile

Average of ratings: Useful (1)