Can't login - Redirects but fails to login

Can't login - Redirects but fails to login

by Matthew Longman -
Number of replies: 7

Moodle 1.9.19

PHP: 5.3.3, 5.4.4 & 5.6.6 tested


Hello, I am attempting a standard installation of moodle 1.9.19. When installation has completed, I am automatically logged in as the admin. If I attempt to logout and back in, I am redirected to the homepage without actually being logged in. Please advise.


This is the output in my apache error log when attempting to sign in: 

[Wed Aug 26 08:52:35 2015] [error] [client 10.0.2.2] PHP Deprecated:  Function eregi_replace() is deprecated in /var/www/moodle/lib/weblib.php on line 2051, referer: http://localhost:8080/moodle/login/index.php
[Wed Aug 26 08:52:35 2015] [error] [client 10.0.2.2] PHP Deprecated:  Function eregi_replace() is deprecated in /var/www/moodle/lib/weblib.php on line 2052, referer: http://localhost:8080/moodle/login/index.php
[Wed Aug 26 08:52:35 2015] [error] [client 10.0.2.2] PHP Deprecated:  mktime(): The is_dst parameter is deprecated in /var/www/moodle/lib/moodlelib.php on line 1785, referer: http://localhost:8080/moodle/login/index.php


Alternatively, if I were to install the latest version of Moodle and attempting to create a theme for that, would it still be valid for Moodle 1.9? As another alternative, does anyone have a Moodle 1.9 site that I can impose my theme on while under development?

Average of ratings: -
In reply to Matthew Longman

Re: Can't login - Redirects but fails to login

by Brian Lockwood -

Sorry to ask an obvious question but why 1.9.19 or do you mean 2.9?


In reply to Brian Lockwood

Re: Can't login - Redirects but fails to login

by Matthew Longman -

The site was originally created in 2009. I am creating a new theme to give it a 2015 spin while the client and I discuss a completely new site.

In reply to Matthew Longman

Re: Can't login - Redirects but fails to login

by Brian Lockwood -

Right. Did you get success reported for every modules when the install script ran?

Did you get to the page to fill in your administrator details? Your brief post was not clear on this point.

Are you being prompted because you did not fill in every field in the administrator set up page?

You do have a potential problem because you are installing a set of php code which was built against an old version of php and your php is (presumably) very new. I would guess that there are very few people out there who are doing this.


Is there anything in the logs?





In reply to Brian Lockwood

Re: Can't login - Redirects but fails to login

by Matthew Longman -

Yes, I got a success message for each stage of installation. I was able to fill in my administrator details during installation. I am not being prompted by/about the administrator page on login. I've attached the apache error logs to the OP.

In reply to Matthew Longman

Re: Can't login - Redirects but fails to login

by Robert Brenstein -
Are you sure you are not logged in? Have you tried clicking the home link in the breadcrumb?

Are you accessing more than one Moodle site from that computer? Does each site has a different cookie prefix set?

I have an instance of Moodle 1.9 running with PHP 5.3.10 and I do not see those errors in my logs. All ereg functions were indeed deprecated in PHP 5.3, but maybe some PHP builds have different warning settings. However, those warnings should not affect operation.
In reply to Matthew Longman

Re: Can't login - Redirects but fails to login

by Ken Task -
Picture of Particularly helpful Moodlers

Ran 1.9.19+ with PHP 5.3.3 for a long time.  Never saw that ...

Wonder if one could hack and get by this if just working on a theme (which may/may not be used when 'customer' upgrades to 2.x).

The error reports 'depreciated' and only in one file: 

lib/weblib.php 
A search of that file shows the following instances:

fgrep 'eregi_replace' lib/weblib.php
            $text = eregi_replace('(<a [^<]*href=["|\']?([^ "\']*)["|\']?[^>]*>([^<]*)</a>)','\\3 [ \\2 ]', $text);
            $text = eregi_replace('(<a [^<]*href=["|\']?([^ "\']*)["|\']?[^>]*>([^<]*)</a>)','\\3 [ \\2 ]', $text);
            $text = eregi_replace("([^a-z])language(:space:*)=", "\\1Xlanguage=", $text);
            $text = eregi_replace("([^a-z])on([a-z]+)(:space:*)=", "\\1Xon\\2=", $text);
    $text = eregi_replace(">(:space:+)<", "><", $text);
    $text = eregi_replace("([\n\r])<", " <", $text);
    $text = eregi_replace(">([\n\r])", "> ", $text);

Not a programmer, but what if one replace the function eregi_replace( stuff ) with

preg_replace (that stuff)

Since you're stuck now, would it hurt?

You also mentioned installation had a bunch of errors, but didn't say what ... water under the bridge now, but do you happen to re-call any of those?

http://php.net/manual/en/function.preg-replace.php

OR, what would happen if you commented those lines out altogther?

Actually, might be a good reason to convince 'customer' it's time to move upwards/forward.   I liked that 62 chevy I had, but, alas, there came a time ....

'spirit of sharing', Ken

In reply to Matthew Longman

Re: Can't login - Redirects but fails to login

by Ken Task -
Picture of Particularly helpful Moodlers

BTW, have a 1.9.19+ site running under PHP 5.5.28 no issues like you've experienced.   Unfortunately, cannot grant you the access needed to develop a theme.

So from where did you acquire the 1.9.19+ code?   I see a localhost url is reason I ask.

It does spit out errors but none fatal and none that redirect to front page after logging on + not logged on.  So think there is something else causing this.

Try adding the following two lines to the config.php file:

$CFG->admin     = 'admin';
$CFG->dbsession = '0';

'spirit of sharing', Ken