Forums | Mahara Community

Mahara/Moodle integration /
Error adding Moodle as an institution


Wullie's profile picture
Posts: 252

18 July 2011, 4:30

Hi,

When trying to integrate Moodle and Mahara, I get the following error

"An error occurred while retrieving the public key from the remote server.
Please ensure that the Application and WWW Root fields are correct, and that networking is enabled on the remote host.
Error retrieving public key, failed with error code 0: Curl error: 7: couldn't connect to host"

The Application is correct, the WWW Root field is correc and networking is enabled on the Moodle site.

The section from the error logs is as follows

[Mon Jul 18 09:58:12 2011] [error] [client 172.20.12.19] [WAR] ee (lib/web.php:3071) Curl error: 7: couldn't connect to host, referer: http://mahara.mysite.com/admin/users/addauthority.php?add=1&i=moodleeportfolio&p=xmlrpc
[Mon Jul 18 09:58:12 2011] [error] [client 172.20.12.19] Call stack (most recent first):, referer: http://mahara.mysite.com/admin/users/addauthority.php?add=1&i=moodleeportfolio&p=xmlrpc
[Mon Jul 18 09:58:12 2011] [error] [client 172.20.12.19]   * log_message("Curl error: 7: couldn't connect to host", 8, true, true) at /var/www/lib/errors.php:109, referer: http://mahara.mysite.com/admin/users/addauthority.php?add=1&i=moodleeportfolio&p=xmlrpc
[Mon Jul 18 09:58:12 2011] [error] [client 172.20.12.19]   * log_warn("Curl error: 7: couldn't connect to host") at /var/www/lib/web.php:3071, referer: http://mahara.mysite.com/admin/users/addauthority.php?add=1&i=moodleeportfolio&p=xmlrpc
[Mon Jul 18 09:58:12 2011] [error] [client 172.20.12.19]   * mahara_http_request(array(size 5)) at /var/www/api/xmlrpc/lib.php:752, referer: http://mahara.mysite.com/admin/users/addauthority.php?add=1&i=moodleeportfolio&p=xmlrpc
[Mon Jul 18 09:58:12 2011] [error] [client 172.20.12.19]   * get_public_key("http://moodle.mysite.com", "moodle") at /var/www/lib/peer.php:234, referer: http://mahara.mysite.com/admin/users/addauthority.php?add=1&i=moodleeportfolio&p=xmlrpc
[Mon Jul 18 09:58:12 2011] [error] [client 172.20.12.19]   * Peer->bootstrap("http://moodle.mysite.com", null, "moodle", "moodleeportfolio") at /var/www/auth/xmlrpc/lib.php:866, referer: http://mahara.mysite.com/admin/users/addauthority.php?add=1&i=moodleeportfolio&p=xmlrpc
[Mon Jul 18 09:58:12 2011] [error] [client 172.20.12.19]   * PluginAuthXmlrpc::validate_config_options(array(size 20), object(Pieform)) at Unknown:0, referer: http://mahara.mysite.com/admin/users/addauthority.php?add=1&i=moodleeportfolio&p=xmlrpc
[Mon Jul 18 09:58:12 2011] [error] [client 172.20.12.19]   * call_user_func_array(array(size 2), array(size 2)) at /var/www/lib/mahara.php:1184, referer: http://mahara.mysite.com/admin/users/addauthority.php?add=1&i=moodleeportfolio&p=xmlrpc
[Mon Jul 18 09:58:12 2011] [error] [client 172.20.12.19]   * call_static_method("PluginAuthXmlrpc", "validate_config_options", array(size 20), object(Pieform)) at /var/www/admin/users/addauthority.php:123, referer: http://mahara.mysite.com/admin/users/addauthority.php?add=1&i=moodleeportfolio&p=xmlrpc
[Mon Jul 18 09:58:12 2011] [error] [client 172.20.12.19]   * auth_config_validate(object(Pieform), array(size 20)) at Unknown:0, referer: http://mahara.mysite.com/admin/users/addauthority.php?add=1&i=moodleeportfolio&p=xmlrpc
[Mon Jul 18 09:58:12 2011] [error] [client 172.20.12.19]   * call_user_func_array("auth_config_validate", array(size 2)) at /var/www/lib/pieforms/pieform.php:1322, referer: http://mahara.mysite.com/admin/users/addauthority.php?add=1&i=moodleeportfolio&p=xmlrpc
[Mon Jul 18 09:58:12 2011] [error] [client 172.20.12.19]   * Pieform->validate(array(size 20)) at /var/www/lib/pieforms/pieform.php:492, referer: http://mahara.mysite.com/admin/users/addauthority.php?add=1&i=moodleeportfolio&p=xmlrpc
[Mon Jul 18 09:58:12 2011] [error] [client 172.20.12.19]   * Pieform->__construct(array(size 5)) at /var/www/lib/pieforms/pieform.php:161, referer: http://mahara.mysite.com/admin/users/addauthority.php?add=1&i=moodleeportfolio&p=xmlrpc
[Mon Jul 18 09:58:12 2011] [error] [client 172.20.12.19]   * Pieform::process(array(size 5)) at /var/www/lib/pieforms/pieform.php:71, referer: http://mahara.mysite.com/admin/users/addauthority.php?add=1&i=moodleeportfolio&p=xmlrpc
[Mon Jul 18 09:58:12 2011] [error] [client 172.20.12.19]   * pieform(array(size 5)) at /var/www/admin/users/addauthority.php:103, referer: http://mahara.mysite.com/admin/users/addauthority.php?add=1&i=moodleeportfolio&p=xmlrpc
[Mon Jul 18 09:58:12 2011] [error] [client 172.20.12.19] , referer: http://mahara.mysite.com/admin/users/addauthority.php?add=1&i=moodleeportfolio&p=xmlrpc
[Mon Jul 18 09:58:12 2011] [error] [client 172.20.12.19] [DBG] ee (auth/xmlrpc/lib.php:868) Error retrieving public key, failed with error code 0: Curl error: 7: couldn't connect to host, referer: http://mahara.mysite.com/admin/users/addauthority.php?add=1&i=moodleeportfolio&p=xmlrpc

Anyone have any suggestions of where I (or probably more specifically my IT team, as I only have ftp access to the server) can look at next?

anonymous profile picture
Account deleted
Posts: 214

18 July 2011, 6:46

Hi Wullie,

If your IT team have direct access to the server, I'd get them to try telnetting into the web server of your moodle server. So for example, if your wwwroot is moodle.mysite.com and it runs on port 80, I'd try:

telnet moodle.mysite.com 80

It could be that your site is behind a proxy server and you need to put these settings on, or that a firewall is in place (outbound or inbound).

Hope that this helps,

Andrew

Wullie's profile picture
Posts: 252

18 July 2011, 8:25

Andrew,

Thanks for your suggestions.

I have been informed that telnet does not come back with an error for the site and port number (I checked that myself too), that there is no proxy and that the servers are both this side of the firewall.

Any further suggestions?

anonymous profile picture
Account deleted
Posts: 214

18 July 2011, 9:28

If the telnet does not come back with the connection, then it's not an issue with Mahara. It could be an issue with your web server configuration (on your moodle end). It's probably worth checking your web server's logs.

Andrew

Wullie's profile picture
Posts: 252

19 July 2011, 3:15

Andrew,

Telnet connects, but displays nothing .

I've had a look at the moodle server error log and there is nothing in there at all related to Mahara.

Thanks

Wullie's profile picture
Posts: 252

19 July 2011, 8:36

Andrew,

Further tests indicate that wget connects from the mahara server to the moodle server, so there is a connection there and on port 80.

Any other suggestions/things I can check?

Thanks

anonymous profile picture
Account deleted
Posts: 214

19 July 2011, 10:44

Hi Wullie,

Sorry - I misread your previous statement as not coming back (at all) rather than not coming back with an error ;)

It does sound like a port is specified incorrectly or with the wrong protocol, or a proxy is specified (when it shouldn't be).

What version of Moodle and Mahara are you trying to network together? Is networking definately turned on on Moodle? Can you see mahara connecting in your apache access log?

Andrew

Wullie's profile picture
Posts: 252

20 July 2011, 3:15

Andrew,

I am using Moodle 1.9.11+ and Mahara 1.4 (1.4 should still be able to network and I haven't missed that disappearing have I?) and networking is definately turned on in Moodle, as per below

Networking Moodle

The mahara log that I posted in the first post is the only bit that is not cron related (although there are 2-3 versions of the same errors from each of my attempts).

I've been informed that the Mahara server and the Moodle server can both telnet to each other on port 80.

Is there any other commands/debugging I can use to check connections/ports/proxy etc..?

Thanks for all your assistance, very much appreciated.

anonymous profile picture
Account deleted
Posts: 214

20 July 2011, 10:33

Hi Wullie,

I'm afraid that I'm out of obvious ideas -- time to get your php hack on and find the issue I'm afraid!

Any chance you could PM me the settings you're trying to put in so that I can sanity check them?

 

The error is coming from the attempt to retrieve the public key from moodle, which calls a function in lib/web.php (mahara_http_request). All that does is a load of adding defaults (e.g. proxy settings, default timeout, maximum number of redirects, etc) and then calls the php curl library.

Could you possibly add the following to api/xmlrpc/lib.php at line 751:

log_info($config);

Feel free to PM me this instead of posting it here if you feel it necessary.

As I say, mahara really isn't doing very much with the your settings except pass them to the php curl library.

Could you possibly join the #mahara IRC channel? It may make diagnosing this a little faster if we can chat in real time ;)

Andrew

Wullie's profile picture
Posts: 252

21 July 2011, 4:34

Andrew,

I've PM'd you details as requested.

Thanks

27 results