Wednesday, March 9, 2011

Install moodle under linux plesk

I have had so many issues installing Moodle and in searching the forums have found that many people had similar issues, though mine perssisted. So I figured I'd write a little guide with my experiences in it to help others in their search.

I'm running moodle with mediatemple.net on a dedicated virtual server. Specs are:

* CentOS release 5 (Final)
* Apache (version 2.2.3)
* Perl (version 5.8.8)
* PHP (version 5.2.5)
* MySQL (version 5.0.22)

This should help with pretty much any Linux/Unix OS on a Vhosts/Plesk setup.

First skip the install.php process and edited the config.php file directly. In order to do this you need to make the folder moodledata outside of your httpdocs directory.

Unfortunately you likely can't do that without root access. So SSH into the server with root and mkdir moodledata in your vhosts/domain.com/ directory.

chmod the directory to 777 (try different permissions once you get it to work). chown the directory with -apache -apache

Now you need to turn off php safe_mode in your php.ini file likely located in your /etc/ folder. Just change safe_mode on to safe_mode off. Then restart your appache server, but if you follow the rest of the instructions you'll need to do that later anyway.

Funny thing is - this will get you past the installation phase. Unfortunately, won't let you do anything inside Moodle. You won't be able to create courses or add users. If you follow your error log it will say open_basedir restrictions in effect, is outside the specified path(s). Or something similar.

There are many posts in the forum for ways to deal with open_basedir restrictions and only one of them worked for my vhosts setup...

in /var/www/vhosts/domain.com/conf create a file called vhost.conf

Inside put:



php_admin_flag engine on

php_admin_value open_basedir "/var/www/vhosts/domain.com/httpdocs/:/var/www/vhosts/domain.com/moodledata:/tmp"



If you do this you'll be able add users and even upload users from a csv file with the right plugin. You'll need to enter this command in your SSH console:

/usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=domain.com

And restart your server.

Unfortunately, if your setup is like mine, this will still leave you with one more problem. If you try to upload files to sitefiles or to courses it will say "the site administrator needs to fix file permissions". And if you check your server logs it will give you the same open_basedir restrictions error as before.

You also need to create another entry in your vhost.conf file:



php_admin_flag engine on

php_admin_value open_basedir "/var/www/vhosts/domain.com/httpdocs/moodledata/:/var/www/vhosts/domain.com:/tmp"



The first entry ensures that httpdocs can write to moodledata but this second one ensures moodledata can write back to httpdocs. Don't forget to:

/usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=domain.com

and restart your apache server.

As an alternative, if you want, you MIGHT be able to turn off open_basedir restrictions inside your php.ini file. I didn't get to trying this but have a feeling that it won't work.

The reason it won't work on a vhost setup is that the open_basedir command is located in A LOT OF PLACES, not just php.ini. In some places it's turned on, in others it's turned off. You essentially need to specify whether it's on or off on a PER DOMAIN but also PER DIRECTORY basis.

Hope this helps someone,





Me, again. Just encountered and resolved a strange behavior involving the "php_admin_value open_basedir is in effect" error message.

I spent much of today struggling with installing Moodle on a different domain also hosted on my new VPS Plesk account. I went through exactly the same procedures described above by Tarik as I did yesterday, but instead of sweet success, I encountered the "open_basedir in effect" error message from hell on the second page of the Moodle installation process. Arghhh!!!

Looking carefully at the error message, I noticed an inconsistency in the message-- the first part of the error message mentions the directory "moodledata" is not in the permitted directory "moodledata1"-- which is true since I had named the moodle data directory placed above the web root "moodledata1". But here was the Moodle install.php file apparently looking for the directory moodledata, seemingly before it had asked me for the name of the data directory. Odd. I've never seen that script behavior before.

So I decided to try feeding install.php what it seemed to be asking for. I renamed moodledata1 to moodledata, changed the references in my vhost.conf file, reconfigured vhost, restarted Apache2, and then pointed my browser to install.php-- and this time Moodle sailed through the installation without a hiccup!

This is very strange, I think, because I have installed Moodle several other times on non-VPS hosts (shared hosting with Cpanel access) using various custom names for the Moodle data directory without Moodle ever complaining.

Has anyone else run into this problem?

I was hoping to install a second Moodle on the same domain to serve as an archive, but if I can only name and use ONE Moodle data directory... then that's a problem.

Puzzled for now. But at least my single Moodle installation is working. thoughtful




http://download1.parallels.com/Plesk/PPP9/Doc/en-US/plesk-9.0-administrators-guide.pdf

No comments: