v2.5.6 install issue

v2.5.6 install issue

by Ed Snowdon (no, not THAT one) -
Number of replies: 16

Let me preface this post with the following facts:  I'm Linux newbie (new career - ex-OpenVMS guy), and I've just begun my Moodle support career as well - I've taken over from somebody who quit the company. This is the 1st time I'm attempting to install/support Moodle

    So please be gentle with me and please use small words in any replies wink

I'm having problems accessing a new pre-production Moodle install to finalize the installation of the application.I believe that the issue is with file permissions & ownerships, but as I said before, I'm a Linux neophyte, so I'm reaching out for some assistance.

The company has a working Moodle v1.9 install, and a test/pre-production Moodle 2.5.4+ installation - both on a creaky old VPS, but we need to move Moodle to a new physical server for a variety of reasons (mostly dealing with up-time). We tried getting our hosting company to move the working pre-production Moodle account to a new VPS instance on a new physical machine but that has not worked properly.

The NEW VPS Environment

CENTOS 6.5 x86_64 virtuozzo - vps

cPanel/WHMv.11.44.0 (build 19)

RAM:4Gb physical / 8GB burstable

Apache: v2.2.27

MySQL:v5.5.35-33.0

Php:v5.4.27

Moodle: v2.5.6

I'm trying to manually installing a Moodle v2.5.6 instance on this brand new VPS, so to that end I created a NON_REGISTERED domain on the new VPS and called the test domain moodle256.biz - just to see how the process is supposed to work. I know that we should be using a newer version of Moodle than 2.5.6, but we're going to stay on v2.5.6 only until this November - we just don't have time to deal with any more software issues that newer releases may bring to us - we figured that 2.5.6 is as far as we're willing to push the envelope at this time.

Using the v2.5 installation instructions from moodle.org, and instructions from the Moodle book, "Moodle 2 Administration”, by Alex Buchner, I executed the following steps:

1)Created the unregistered domain/account on the VPS using cPanel. This account has 3GB of disk quota.

2)Copied the Moodle v2.5.6 .zip into the /public_html folder

3)Extracted the Moodle files into /public_html/moodle

4)Renamed the /moodle folder to /training (more for esthetic & clarity reasons than anything).

5)I logged into the VPS as root and executed the following commands:

[root@vps ~]# chown -R root /home/moodle256/public_html/training

[root@vps ~]# chmod -R 0755 /home/moodle256/public_html/training

6)Getting back into cPanel, I used the MySQL Databases tool to create a db, a user, and to associate the user to the db. This user account was given ALL privileges to the db.

7)Using cPanel File Manager. I created a folder called /home/moodle256/moodledata

      8) Used Terminal to change the permissions on the moodledata folder

[root@vps ~] # chmod -R 0777 /home/moodle256/moodledata

9) Changed the user of the moodledata folder to Apache

[root@vps ~] # chown -R apache /home/moodle256/moodledata

10) Change the group of the moodledata folder to 'nobody'

[root@vps ~] # chgrp -R nobody /home/moodle256/moodledata

Because the domain associated with the cPanel account is unregistered (ie. a fake domain not paid-for at any domain registrar - and just used for testing), cPanel has a workaround to allow users to get at the account on the server:

[ IP address][~accountname/moodledirectoryname/ ], so in this casethe URL to access the Moodle installer is xxx.xxx.xxx.xxx/~moodle256/training/

When I execute this URL the new server returns:

404-Not Found

"The server can not find the requested page:

xxx.xxx.xxx.xxx/~moodle256/training (port 80)

Yet if I use the same URL syntax for the 'fake' pre-production Moodle install on the old VPS - it works fine and brings us into the functioning environment.

I've looked at the files in the /home/moodle256/public_html/training/ folder and everything looks ok - the php.ini file that's supposed to guide one through the Moodle instantiation is there.

A this point I'm a bit stumped. I'm pretty sure this is a permissions issue but not sure how to resolve it, so I'm seeking help here.

Thanks for any/all assistance..

Average of ratings: -
In reply to Ed Snowdon (no, not THAT one)

Re: v2.5.6 install issue

by Gary Benner -

HI Ed,

I think it is your browser that is returning the 404 error, as the DNS client on your computer is unable to resolve the fake URL.

if you are running Windows on your workstation, you can place an entry in your HOSTS file to override the DNS client. You can find this at:  c:\windows\systems32\drivers\etc\hosts and edit it using Notepad. Just remember to delete the entry when you are finished.

The entry in the HOSTS file goes like this

xxx.xxx.xxx.xxx      myFakeURL


To test it, open a command prompt and try to ping the fake URL

ping myFakeURL


If that ping works then your browser should be able to access the website at the IP Address resolved by the fake URL.

HTH

Gary


In reply to Gary Benner

Re: v2.5.6 install issue

by Ed Snowdon (no, not THAT one) -

Brett/Gary

On the 'old' VPS we have a working 'fake' domain which IS accessible using the same mechanism -- 209.217.xxx.xxx/~moodle25/training/

and this successfully loads the 'old' pre-production site home page (when that server isn't crashing sad )  The tilde ( ~ ) in the URL is Centos/cPanel/Apache way of allowing 'fake' domains to exist and be successfully resolved. I've made sure that the setting permitting this is identical on both the old & new VPS'es.

I do use a hosts file on both Mac/Win to block/allow various IP's, but none of the machines near me, nor those of others in the company, have any issues successfully resolving the 'old' v1.9 production site -or the v2.5.4 pre-production site. None of these machine have entries in the hosts file to 'deal' with our 'fake' domain . Thus irrespective of the o/s or browser, there's nothing special we have to do to access the 'fake' site.

As to whether root is the correct user for moodle public_html files, all I can do is refer to  http://docs.modle.org/25/en/Installing_Moodle and the section "Download and copy files into place", subsection "Secure the Moodle files", where it says:  chown -R root /path/to/moodle

Again, I'm no Linux or Moodle wizard, but doesn't that documentation say root is the correct owner? Or am I misunderstanding something (which may very well be the case).

In reply to Ed Snowdon (no, not THAT one)

Re: v2.5.6 install issue

by Bret Miller -
Picture of Particularly helpful Moodlers

I echo Gary's response.

In addition, are you sure that root is the right user for the Moodle public_html files?

In reply to Ed Snowdon (no, not THAT one)

Re: v2.5.6 install issue

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
Check the firewall. I found that centos shuts it down by default.
In reply to Emma Richardson

Re: v2.5.6 install issue

by Ed Snowdon (no, not THAT one) -

Emma --

Thanks for that thought. I'm pretty sure I went through the firewall settings on the new VPS with a fine toothed comb, but I will check again. We're using CSF v7.03. Our hosting company has not been the best in helping us migrate - though in fairness they don't explicitly support Moodle.

In reply to Ed Snowdon (no, not THAT one)

Re: v2.5.6 install issue

by Ed Snowdon (no, not THAT one) -

Some further information:

Part A

I just did a small test - taking Moodle totally out of the equation - in order to try to narrow the scope of the problem. I created a new domain named fakedomain.abc using WHM. I then went into cPanel and created a folder - /public_html/training, and created a single file called test.txt and placed it into that folder.</p><p>Then I attempted to access http://209.217.xxx.xxx/~fakedomain/training/ -- which produced the following error:

Internal Server Error
UID of script "/home/fakedomain/public_html/training/index.php" is smaller than min_uid
suPHP 0.7.1

Clearly an index.php was being attempted to be executed where there was none, so I then created a simple index.php file containing a "Hello World" script and then retried http://209.217.xxx.xxx/~fakedomain/training/&nbsp; -- which displayed the correct result "Hello World".


In reply to Ed Snowdon (no, not THAT one)

Re: v2.5.6 install issue

by Gary Benner -

HI Ed,

On a fast learning track I see smile

When having server issues I start by creating a file index.html with "Hello World" (hey I'm a programmer!) as that tests the DNS and Apache configuration (I use Virtual Domains). I always explicitly specifiy the filename. eg:

http://<url>/index.html

Getting the "Hello World" message confirms that part.

I then create an index.php with the following:

<?PHP

phpinfo();

?>

This should show the PHP Info screen, which confirms that PHP is correctly installed and integrated with Apache, and also provides a confirmation of what modules are loaded, where the php.ini file is located, etc.

I then load Moodle, or if already loaded, restore the Moodle index.php. This should tell you if your DB configuration is correct etc. You can sometimes get errors if there are some missing PHP modules required by Moodle, although a new install will tell you this.

HTH

cheers

Gary


In reply to Gary Benner

Re: v2.5.6 install issue

by Ed Snowdon (no, not THAT one) -
Gary 1) I deleted the Moodle test account from the server in order to start fresh. 2) I created a new test account and then created an index.html "Hello World" file and that loaded fine. 3) I created an index.php file as you suggested and got the phpinfo dump correctly (see truncated version below). Is there anything super critical in the phpinfo I should be looking for? PHP Logo PHP Version 5.4.27 System Linux vps.fp-dev.com 2.6.32-042stab079.4 #1 SMP Thu Jul 18 18:57:29 MSK 2013 x86_64 Build Date Apr 9 2014 09:02:18 Configure Command './configure' '--enable-bcmath' '--enable-calendar' '--enable-exif' '--enable-ftp' '--enable-gd-native-ttf' '--enable-libxml' '--enable-mbstring' '--enable-pdo=shared' '--enable-soap' '--enable-sockets' '--enable-wddx' '--enable-zip' '--prefix=/usr/local' '--with-bz2' '--with-curl=/opt/curlssl/' '--with-curlwrappers' '--with-freetype-dir=/usr' '--with-gd' '--with-gettext' '--with-imap=/opt/php_with_imap_client/' '--with-imap-ssl=/usr' '--with-jpeg-dir=/usr' '--with-kerberos' '--with-libdir=lib64' '--with-libexpat-dir=/usr' '--with-libxml-dir=/opt/xml2' '--with-libxml-dir=/opt/xml2/' '--with-mcrypt=/opt/libmcrypt/' '--with-mysql=/usr' '--with-mysql-sock=/var/lib/mysql/mysql.sock' '--with-mysqli=/usr/bin/mysql_config' '--with-openssl=/usr' '--with-openssl-dir=/usr' '--with-pcre-regex=/opt/pcre' '--with-pdo-mysql=shared' '--with-pdo-sqlite=shared' '--with-pgsql=/usr' '--with-pic' '--with-png-dir=/usr' '--with-pspell' '--with-tidy=/opt/tidy/' '--with-xmlrpc' '--with-xpm-dir=/usr' '--with-xsl=/opt/xslt/' '--with-zlib' '--with-zlib-dir=/usr' Server API CGI/FastCGI Virtual Directory Support disabled Configuration File (php.ini) Path /usr/local/lib Loaded Configuration File /usr/local/lib/php.ini Scan this dir for additional .ini files (none) Additional .ini files parsed (none) PHP API 20100412 PHP Extension 20100525 Zend Extension 220100525 Zend Extension Build API220100525,NTS PHP Extension Build API20100525,NTS Debug Build no Thread Safety disabled Zend Signal Handling disabled Zend Memory Manager enabled Zend Multibyte Support provided by mbstring IPv6 Support enabled DTrace Support disabled Registered PHP Streams compress.zlib, compress.bzip2, dict, ftp, ftps, gopher, http, https, imap, imaps, pop3, pop3s, rtsp, smtp, smtps, telnet, tftp, php, file, glob, data, phar, zip Registered Stream Socket Transports tcp, udp, unix, udg, ssl, sslv3, sslv2, tls Registered Stream Filters zlib.*, bzip2.*, convert.iconv.*, mcrypt.*, mdecrypt.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk Zend logo This program makes use of the Zend Scripting Language Engine: Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies with the ionCube PHP Loader v4.4.1, Copyright (c) 2002-2013, by ionCube Ltd., and with Zend Guard Loader v3.3, Copyright (c) 1998-2013, by Zend Technologies ...etc.....
In reply to Ed Snowdon (no, not THAT one)

Re: v2.5.6 install issue

by Ed Snowdon (no, not THAT one) -

Part B


So now I have two cPanel accounts/unregistered domains - fakedomain.abc and moodle256.biz - both of which were created exactly the same way within WHM/cPanel, and there are two differences between them:

a) Moodle is not installed in fakedomain.abc, whereas the Moodle files are extracted in moodle256.biz (with the addition of moodledata folder) and with the Moodle recommended permissions set.

b) http://209.217.xxx.xxx/~fakedomain/training/ launches index.php correctly, whereas http://209.217.xxx.xxx/~moodle256/training/ results in an Internal Server Error UID of script "/home/moodle256/public_html/training/index.php" is smaller than min_uid even though the index.php file is present in the training folder.

This is clearly a permissions/ownership issue, but I'm not sure what to do to fix this (OpenVMS guy and all that).

Could it be as simple as:

a) when I was executing all the terminal commands I was logged in as root, rather than logged in as the moodle256 admin user, even though root is capable of granting permissions/ownership to anyone for anything?

or

b) in the Installing Moodle document, in the "Secure the Moodle files" section it states:

If you want to use the built-in add-on installer you need to make the directory writable by web server user. It is strongly recommended to
use ACL when your server supports it, for example if your Apache server uses account www-data:

# chmod -R +a "www-data allow read,delete,write,append,file_inherit,directory_inherit" /path/to/moodle

which then leads me to the Linux/Moodle newbie question, "How do I know if I want to use the built-in add-on installer, or should I just execute this command anyway?" -- as I did NOT execute the chmod -R +a ..etc.... command yet because it is unclear to me whether or not I really need to.

 

In reply to Ed Snowdon (no, not THAT one)

Re: v2.5.6 install issue

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

My Moodle folder is set to apache:root for owner.  I believe I have permissions set as 755.

Have you redirected Apache to the Moodle folder?  

In reply to Emma Richardson

Re: v2.5.6 install issue

by Ed Snowdon (no, not THAT one) -

Emma,


Doesn't the command below do that?

# chmod -R +a "www-data allow read,delete,write,append,file_inherit,directory_inherit" /path/to/moodle


This was the only command in the Moodle install documentation that I did not execute as I was uncertain as to whether it was actually required. In any event, I later tried that command as suggested in the Moodle documentation and it failed, complaining about the +a portion of it.



In reply to Ed Snowdon (no, not THAT one)

Re: v2.5.6 install issue

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

chown -R apache:root path/to/moodle

chmod -R 755 path/to/moodle

Run the same on the moodledata folder too.  You can tighten permissions back up later if you want once you get things going.

In reply to Ed Snowdon (no, not THAT one)

Re: v2.5.6 install issue

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers

In step 3, you said that you extracted the moodle program to public_html/moodle.  Later, you said that you get an error going to .../training.  It doesn't appear that your moodle is there, it is in a different directory called moodle.

I also did not see you saying that the moodle installation ran.  Probably, again, you have your moodle in a different directory than you think.

I have had success installing on a VPS without any domain name.  Just use the IP address, such as http://72.167.16.50/~user1/, and put moodle down one level.

Of course, there are many ways to approach this.  You will probably get some other good ideas from others.

In reply to Rick Jerz

Re: v2.5.6 install issue

by Ed Snowdon (no, not THAT one) -

Hi Rick,


I think that was a slip of some very tired fingers.

Just to clarify, when logged in as the account owner in cPanel (I was careful to not login as root):

- I uploaded the Moodle.zip into /public_html

- Extracted the Moodle files using cPanel's File Manager, which extracted into /public_html/moodle
- Then for reasons of clarity for others I renamed /public_html/moodle to /public_html/training



You are correct in saying that the Moodle installer has not been successfully run. It may be a suPHP permissions issue, as I tend to like to run the server locked down pretty tightly - I'm checking into that now.

The attached is what is in /public_html/training, so Moodle has been extracted to the correct location. You can ignore the folder Moodle v2.5.6 (that just has a copy of the Modle.zip file for archive purposes).



Attachment Moodle dirstructure.png
In reply to Ed Snowdon (no, not THAT one)

Re: v2.5.6 install issue

by Rick Jerz -
Picture of Particularly helpful Moodlers Picture of Testers

Installing on a VPS can be a little bit tricky, because some companies leave it up to you to do some (necessary) configuration.  I have a GoDaddy VPS running Moodle just fine, but it took a little to configure it.

1) Do you have all of the required php directives turned on.  For example, on my VPS I have to add zip, xmlrpc, soap, mysql improved, mbstring, intl, gd.

2) When you created the database, did you make sure collations was set to utf8_unicode_ci?

3) I am still not sure (because I am not an expert) if what you are doing with that dummy domain is correct.  I have never done it this way.  I have used just the IP address, and then later, when I assign a domain name to the account I just make some changes in config.php.

4) Maybe you have told us.  When you run the moodle installer by going to .../training, what error message do you get?

Hope that some of this helps.  If what I say doesn't make sense to you, just keep asking.