Installed moodle on raspi but can't access

Installed moodle on raspi but can't access

by Jeffrey Smith -
Number of replies: 12

The install went without problems according to the excellent on-line directions.

When I browse to http://<IP ADDRESS>/moodle I am not greeted by the Moodle home page. I get a "The website encountered an error while retrieving http://<IP ADDRESS>/moodle/. It may be down for maintenance or configured incorrectly" error.

Other clues:

1. if in /var/www/moodle and I do a "sudo php index.php" I get: Command line scripts must define CLI_SCRIPT before requiring config.php

2. If I try to use the install_data base, I get the database table are already present (because I installed it)

3. If I try to upgrade, I get No upgrade needed for the installed version 2.6.11+  (because I installed it)

4. It is not a server access problem. I put a test web  page on http://<IP ADDRESS> and have no trouble accessing the raspi inside or outside my house

Do you have any advice on how to debug this? No much to go on in the web access error. I have no idea where to go when the install said everything went OK but it is not.

Average of ratings: -
In reply to Jeffrey Smith

Re: Installed moodle on raspi but can't access

by Ken Task -
Picture of Particularly helpful Moodlers

Online instructions where ... from Moodle.org?   Didn't know there were specific instructions for installing on a raspi on Moodle.org.   Was it this one:

http://blogs.sequoiainc.com/blogs/raspberry-pi-moodle

Your test ...

#1 ... yep that's true and accurate ... no error there.

#2 ... you said it ... installed it

#3 ... you said it ... 'ditto'

#4 is a valid test of a static web page, how about a phpinfo page?   Moodle is comprised of PHP scripts that talk to the MySQL DB server and both of those render Apache web pages.  Thus the error you see ... '... or configured incorrectly"

Sounds like you installed via command line.   That involved php and mysql ... not apache.  Apache must have PHP supports ... so what does php -i and php -m show you?

Also locate apache error logs and view the log.   That will give you a clue as to what the problem might be.   There is also a section in config-dist.php for turning on debugging via config.php file.   Suggest copying those lines into your active config.php file and let's see what else Moodle might say.

When you do get it up and running, think you'll have to 'revisit' this:

'no trouble accessing the raspi inside or outside my house' .... by FQDN or IP address?   If IP address, which?  the private IP or the public IP?

'spirit of sharing', Ken

In reply to Ken Task

Re: Installed moodle on raspi but can't access

by Jeffrey Smith -

I appreciate all your help here. I did use http://blogs.sequoiainc.com/blogs/raspberry-pi-moodle. I'll attach what php -i,and apache log show me.  I would attach what php -m shows me but will have to do it in another post because this only allows me to attach two files. According to my apache error log, it looks like I may have my config,php permissions wrong. I suspect if I get it right, there will be other permissions and other things to fix but perhaps one at a time. I added ...

"

// debug settings

@error_reporting(E_ALL | E_STRICT);

@ini_set('display_errors', '1');

$CFG->debug = (E_ALL | E_STRICT);

$CFG->debugdisplay = '1';

$CFG->debugusers = '2';

"

to my config.php file but didn't see any difference on access. I tryied to each this by both inside and outside IP address and by FQDN. I used an external no-ip host name that you are welcome to. It is composablelogic.no-ip.biz 


Thanks in advance for all your help. If I forgot anything, or if you'd like more info, please let me know.


In reply to Jeffrey Smith

Re: Installed moodle on raspi but can't access

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
I thought the Apache error is quite straightforward:
[Sat Dec 19 00:02:05 2015] [error] [client 73.69.1.110] PHP Warning: require_once(/var/www/moodle/config.php): failed to open stream: Permission denied in /var/www/moodle/index.php on line 31

Can the running Apache process, in Raspbian the user 'www-data', read /var/www/moodle/config.php? (Just make config.php world-readable, rw-r--r--.)
In reply to Jeffrey Smith

Re: Installed moodle on raspi but can't access

by Ken Task -
Picture of Particularly helpful Moodlers

Well, you are close ... but a few things ...

The web server on raspi is running on port 8080 - or appears to be when accessing from my location (outside).  When using your noip FQDN it does point to a public IP address (with :8080 as port) and if one adds /moodle/ to the URL one gets the mis-configured noticed.

So in config.php use the NO IP FQDN in the wwwroot variable of config.php ... make sure you add port :8080.

$CFG->wwwroot   = 'http://composablelogic.no-ip.biz:8080/moodle';

note the 'no trailing slash' in the URL above.

In your workstations (not the raspi box), think I'd add a line to the host file:

[REALINTERNALIPOFRASPI] composablelogic.no-ip.biz  composablelogic

that way, when at home, one can access it by FQDN url and not have to go out to NOIP DNS.  If you add that line to a laptop and take the laptop to another network, remember to comment out that line and access with true DNS.

+1 to what Visvanath suggested.

Why you can't use IP in wwwroot?   Moodle is not 'relatively addressed'.   Every internal link that is built by Moodle uses the wwwroot variable and records that in the DB.

I wouldn't worry about a broken favicon.ico file ... least of worries with the setup. (IMHO)

Now in testing http://composablelogic.no-ip.biz:8080/moodle from outside to see if that would work, guess what ... noip doesn't know what to do with that :8080.

So adjusting the wwwroot URL to:

http://composablelogic.no-ip.biz/moodle

should work.

I can get directly to the moodle from the outside ... but then get the misconfigured screen from the moodle.

Why is the web server running on 8080?   Why not just it's default port?   Think noip.biz would be happier.

And a suggestion should you have future issues and post to these forums ... provide info about your server (being a raspi, it's not the 'norm') and network setup (no ip etc.).   MIght save someone willing to help some time and get to the issue more quickly/accurately.

Good luck with your raspi! (interesting adventure)

'spirit of sharing', Ken

In reply to Ken Task

Re: Installed moodle on raspi but can't access

by Jeffrey Smith -

Thanks. I appreciate this help. I feel we are getting closer with Moodle on the raspi. My config.php did have the right permissions. I did change to use $CFG->wwwroot   = 'http://composablelogic.no-ip.biz:8080/moodle'; I also tried $CFG->wwwroot   = 'http://composablelogic.no-ip.biz/moodle';

I got the same error web response. I checked the apache error log. I got

"

[Sun Dec 20 06:25:11 2015] [notice] Apache/2.2.22 (Debian) PHP/5.4.45-0+deb7u2 configured -- resuming normal operations

[Sun Dec 20 09:55:32 2015] [error] [client 66.249.88.234] File does not exist: /var/www/:8080, referer: http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=2&ved=0CDwQFjAF&url=http%3A%2F%2Fcomposablelogic.no-ip.biz%2F%3A8080%2Fmoodle'&ei=ZMF2VsaWCoHipQWvYA&usg=AFQjCNE0MpfFCsUqguwdM2elgRlFpBEG-A

[Sun Dec 20 12:02:40 2015] [error] [client 66.249.69.75] File does not exist: /var/www/robots.txt

"

It is looking for a /var/www/robots.txt... what is this file?

In reply to Jeffrey Smith

Re: Installed moodle on raspi but can't access

by Ken Task -
Picture of Particularly helpful Moodlers

robots.txt is a file that search engines like Google look for to get info on what NOT to index from the site it's crawling.   It is not required to run a Moodle nor run any web server. 

Heck, for now, ignore that ... that's NOT your issues.   FOCUS! ;)

The larger issue is the /var/www/:8080.

I'll ask again ... why is the web server running on port 8080?

In the blog page you followed it didn't mention config of apache ... it did say to use the IP address to access.   It didn't mention config of apache for port 8080!   Well, you are trying to take that a step further and use a no-ip FQDN.   That's the issue with Moodle.  wwwroot (in your case) needs to be a FQDN ... to be consistent for access inside as well as outside your home network.

So here's some official docs on apache:

https://httpd.apache.org/docs/trunk/vhosts/examples.html

So ... some more 'fishing' ...

In your apache config file there should be a listen line ... is your apache set to listen on port 8080?

SEE above link to apache docs.

What do you have in /etc/hosts on the raspi box?   Normally, that will have only an entry for loopbackup IP (127.0.0.1) and pointed to localhost.localdomain ... none resolvable to the outside world.

So, suggest (again) making an entry in your /etc/hosts file:

[INTERNALIP] composablelogic.no-ip.biz composablelogic

this will help apache find it's name.   Restart apache server, then check the logs for apache for errors.   In your workstation you are using to access the raspi, do the same thing ... an entry in it's host file with same info as above.   Now if you have a "Wonders" workstation, please don't ask how to do that .... Google for it.   Do know that on a Mac and on Linux that hosts file does exist in /etc/ and I've done what I'm suggesting for a variety of reasons ... it does work.

Now for NO-IP ...

http://www.noip.com/support/knowledgebase/configure-ip-hostname/

Port 80 Redirect: This option needs to be used if your Internet Service Provider blocks port 80, which most commonly do.  It enables you to reach your server without having to type the port after the hostname.

Example: Without Port 80 redirect you would have to type the following into your browser: yourhost.no-ip.org:8080. With Port 80 redirect you can simply type the hostname: yourhost.no-ip.org

From what it says above, I gather, your Moodle and Apache needs to be configured for port 8080???

At this point, since I don't run no-ip, nor raspi, you'll have to figure that out ... Moodle, however, has a requirement that the wwwroot variable *IS* the only way the site can be accessed.

By all means pursue a solution.   And, if you are successful, please come back here and post your resolution for the next person to  'adventure' into raspi with no-ip etc., etc.

'spirit of sharing', Ken

In reply to Jeffrey Smith

Re: Installed moodle on raspi but can't access

by Ken Task -
Picture of Particularly helpful Moodlers

IF my sluething is correct, you are on comcast upstream.    Yes?

Read this my friend:

http://forums.xfinity.com/t5/Home-Networking-Router-WiFi/Comcast-filtering-port-80-now/td-p/2264113

In that forum discussion, they discuss using another port (other than 80) for their internal web server.   They report it works.  In Moodle, however, one can have only ONE FQDN ... that wwwroot line.

What you might have to explore doing is running port 8080 (that's what no-ip suggest) and then on your own apache server running a re-write rule or a reverse proxy to have the apache respond to only the outside FQDN on port 80.

Ok, have done/thought/researched/suggested all I can think of ... best of luck!

'spirit of sharing', Ken



In reply to Ken Task

Re: Installed moodle on raspi but can't access

by Jeffrey Smith -

I wanted to thank you Ken for all your help. You were right all along. Moodle just didn't want to be on port 8080 and it works just fine on the raspi.

I learned a lot through all your informative and timely emails. Thanks again.

In reply to Jeffrey Smith

Re: Installed moodle on raspi but can't access

by Ken Task -
Picture of Particularly helpful Moodlers

Glad to hear it!  You are welcome!   Also glad it wasn't something 'off the wall' cause I had rearched a 'deadend'!!!!

Merry, Merry!

'spirit of sharing', Ken


In reply to Jeffrey Smith

Re: Installed moodle on raspi but can't access

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
For those who refer this thread, the statement, "Moodle just didn't want to be on port 8080" is untrue. I just installed Moodle on a Raspberry Pi at port 8080. It works fine.

Hardware:
- Raspberry Pi 2, ARMv7 Processor rev 5 (Quad core!), 1 GB RAM, 16 GB Class 10 micro USB

Software:
- Raspbian Jessie Lite (minimal image based on Debian Jessie), Release: 2015-11-21, Kernel: 4.1
- Apache/2.4.10 (Raspbian), built: Sep 5 2015 17:38:45
- PHP 5.6.14-0+deb8u1 (cli) (built: Oct 28 2015 00:02:05)
- MySQL version: 5.5.44-0+deb8u1, comment: (Raspbian)

I have the site going at http://ipaddress:8080/.

BTW, Apache serves another site at the default port 80, https://ipaddress/. I am sure that it could serve a third site at https://ipaddress/, if necessary.
In reply to Visvanath Ratnaweera

Re: Installed moodle on raspi but can't access

by Ken Task -
Picture of Particularly helpful Moodlers

Yes, as does just about any NIX flavored box will run apache on port 8080 (well known alternative port for web).   After all, a Raspberry Pi is pre-installed Ubuntu/Debian based flavored OS.     Am sure it was just the way op 'phrased' it. ;)

The *key* was NO-IP and it's config ... + not all providers allow port 80 serving on home connections ... which are different than a biz class connection.

With NO-IP one can acquire a Geotrust QuickSSL Premium SSL certificate - better than self-signed.

Don't claim to be a no-ip expert ... don't use the service as connection to provider isn't a biz setup and I'd rather use bandwidth for other purposes. ;)

'spirit of sharing', Ken


In reply to Ken Task

Re: Installed moodle on raspi but can't access

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Ken

In the mean time set that Moodle to answer http://my.ddns.net:8080. No problem!

I know, if the other person's service provider blocks traffic to a port, he has no chance of serving that port. What I am saying is that Raspbian has no problem in serving Moodle through port 8080.