Auth failure when installing and running php artisan migrate

455 views
Skip to first unread message

al...@alexlittle.net

unread,
Mar 25, 2016, 7:58:07 AM3/25/16
to Learning Locker
Hi all,

I'm new to LearningLocker (and also MongoDB), but am trying to get it set up on my local computer for testing. I seem to have got some way with the installation process (following: http://docs.learninglocker.net/installation/), but when I try to run the `php artisan migrate` command I keep getting an authentication failure message.

I hope this is the correct place to post - but just let me know if not.

The full error that I get is as follows:

> php artisan migrate
Status: 500 Error: Failed to connect to: localhost:27017: Authentication failed on database 'learninglocker' with username 'root': auth failed


[MongoConnectionException]
Failed to connect to: localhost:27017: Authentication failed on database 'l
earninglocker' with username 'root': auth failed

migrate [--bench[="..."]] [--database[="..."]] [--force] [--path[="..."]] [--package[="..."]] [--pretend] [--seed]


I realise that this is most likely due to my setup with Mongo, but I'm really failing to see where I may have gone wrong. For info I'm on Ubuntu 14.04 LTS Desktop, running Mongo 3.2.4 and I have Mongo PHP driver v1.6.13 installed (at least in my phpinfo() output says it's installed and enabled).

I set up the database in Mongo with `use learninglocker` and adding a user ('learnlock') with the `readWrite` role as follows:

> use learninglocker
switched to db learninglocker
> db.createUser(
... {
... user: "learnlock",
... pwd: "****",
... roles: [ { role: "readWrite", db: "learninglocker" } ]
... }
... )
Successfully added user: {
"user" : "learnlock",
"roles" : [
{
"role" : "readWrite",
"db" : "learninglocker"
}
]
}
>

I set this up in Mongo whilst authentication was disabled, then restarted with Mongo auth enabled. Logging in via the terminal and the login credentials seems to work fine:

> mongo -u learnlock -p **** --authenticationDatabase learninglocker
MongoDB shell version: 3.2.4
connecting to: test
> use learninglocker
switched to db learninglocker
>

So struggling to understand why the migrate command isn't authenticating.

I'm little unclear if this is due to my lack of knowledge around Mongo, or learninglocker. If any more output/setup/log info is needed to help then feel free to let me know.

Any help would be very much appreciated,

Cheers,
Alex

Ryan Smith

unread,
Mar 25, 2016, 10:13:27 AM3/25/16
to Learning Locker
Hi Alex, thanks for reporting your issue, in future you'll probably be better served creating issues on the Learning Locker Github repository.

Have you configured Learning Locker correctly in a "app/config/local/database.php" file? It should look somewhat similar to "app/config/database.php".

Thanks and kind regards,
Ryan

Alex Little

unread,
Mar 31, 2016, 2:54:39 AM3/31/16
to learnin...@googlegroups.com
Thanks Ryan,

I think the database.php is all set up ok, I made a copy of the 'app/config/database.php' into 'app/config/local/database.php' and updated the username/pwd & db. It certainly looks like it's reading the file ok as the message, as it's picking up the username and db that's in my local database.php (so also assume it;s picking up the pwd from there too).

Looks, to me at least, that it's more an issue with how I've got Mongo and PHP set up and configured, rather than issue/bug directly with Learning Locker.

Will have another play around and let you know if I figure out what's going wrong.

Cheers & thanks again,

Alex
--
You received this message because you are subscribed to a topic in the Google Groups "Learning Locker" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/learning-locker/3tSYHrOfuto/unsubscribe.
To unsubscribe from this group and all its topics, send an email to learning-lock...@googlegroups.com.
To post to this group, send email to learnin...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Alex Little
Director, Digital Campus
al...@digital-campus.org
http://digital-campus.org
mobile (UK): +44 7548 236 650
mobile (Finland): +358 45 640 2013
skype: alexlittleou
twitter: @digicampusteam & @alexlittle

Ryan Smith

unread,
Mar 31, 2016, 6:24:50 AM3/31/16
to Learning Locker, al...@digital-campus.org
You're welcome Alex.

Ok that sounds right to me. Yeah it's probably safe to assume the password is picked up from there too.

Ok then. Yeah please do let us know if this is resolved and how it was resolved as might be of use to other users in the future.

You're very welcome, thanks for getting in touch.

Kind regards,
Ryan

mca...@entornosdeformacion.com

unread,
Apr 12, 2016, 6:33:33 AM4/12/16
to Learning Locker
I faced the same issue some months ago and i resolved it, the problem resides in the mongoDB PHP driver (extension).

https://docs.mongodb.org/ecosystem/drivers/php/

Miguel

Alex Little

unread,
Apr 15, 2016, 2:27:39 AM4/15/16
to learnin...@googlegroups.com
Thanks Miguel,

Just been having a look at the link you sent and trying a few things out. I have the mongodb-1.1 installed and enabled (according to my phpinfo - I removed the mongo-1.6 driver that I had before), which should work with  Mongo3.2 according to the table. However still no luck getting it running. I now get a different error message (when running `php artisan migrate`):

PHP Fatal error:  Class 'MongoClient' not found in /home/alex/data/Digital-Campus/development/learninglocker/vendor/jenssegers/mongodb/src/Jenssegers/Mongodb/Connection.php on line 133
Status: 500 Error: Class 'MongoClient' not found{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Class 'MongoClient' not found","file":"\/home\/alex\/data\/Digital-Campus\/development\/learninglocker\/vendor\/jenssegers\/mongodb\/src\/Jenssegers\/Mongodb\/Connection.php","line":133}}

So none of these issues I'm having are really to do with LearningLocker  - it's just the Mongo to PHP connection that seems very 'sensitive'. Probably now I've uninstalled/re-installed enabled/disabled various versions of mongo and mongodb drivers too many times - so I'd be better starting with a fresh virtual install of Ubuntu and go from there (I'll end up running it in a virtual machine anyway)

I'll let the list know how I get on...

Cheers and thanks again for the help...

Alex

Ryan Smith

unread,
Apr 15, 2016, 4:07:29 AM4/15/16
to Learning Locker, al...@digital-campus.org
Thanks for the update Alex, sorry to hear that you're having so much trouble with Mongo and PHP. Best of luck with the fresh install. We do offer a hosted version of LL if you'd prefer that https://learninglocker.net/get-started/

mojo...@gmail.com

unread,
May 4, 2016, 12:13:53 PM5/4/16
to Learning Locker, al...@digital-campus.org
Was this ever resoloved? I'm having the same issue.

Ryan Smith

unread,
May 4, 2016, 2:12:56 PM5/4/16
to Learning Locker, al...@digital-campus.org, mojo...@gmail.com
Hi, please ensure that you're using the latest version of the MongoDB PHP Extension and version 3.x of Mongo. If you're using a username and password to connect to your database, please add a "app/config/local/database.php" file to your installation similar to the "app/config/database.php" file, except with the "username", "password", and "database" properties changed.

Thanks and kind regards,
Ryan

Alex Little

unread,
May 5, 2016, 2:23:11 AM5/5/16
to learnin...@googlegroups.com
I've not yet got it fixed, but then I've been quite busy the last weeks so haven't had chance to try again properly - for sure will post back once I've tried again and let you know how I get on,
Cheers,
Alex

mobile (UK): +44 7548 236 650
mobile (Finland): +358 45 640 2013
skype: alexlittleou
twitter: @alexlittle

Chris Swenson

unread,
May 9, 2016, 11:04:21 AM5/9/16
to Learning Locker, al...@digital-campus.org
I started with a fresh Ubuntu 14 install instead of Ubuntu 16 and sailed right through the instructions and am able to load / send statements. I haven't investigated further, but that fixed my issue. 

C.

anthk...@gmail.com

unread,
Oct 8, 2016, 7:10:48 PM10/8/16
to Learning Locker, al...@digital-campus.org, mojo...@gmail.com
Hey, I'm having the same issue. As far as I can tell, I do have the latest php driver installed but it still isn't working and I'm getting this error. Not sure what to do.

.Matched packages, channel pecl.php.net:
=======================================
Package Stable/(Latest) Local
mongo 1.6.14 (stable) MongoDB database driver
mongodb 1.2.0alpha3 (alpha) 1.1.8 MongoDB driver for PHP

anthk...@gmail.com

unread,
Oct 8, 2016, 8:41:25 PM10/8/16
to Learning Locker, al...@digital-campus.org, mojo...@gmail.com, anthk...@gmail.com

Never mind! I figured it out!

Alex Little

unread,
Oct 9, 2016, 8:06:50 AM10/9/16
to learnin...@googlegroups.com

Hi - what did you need to do to get this working?

Admittedly I've not had chance to look back at this for quite a while, but am planning on doing so soon, so any pointers would be very helpful.

Cheers,

Alex

mobile (UK): +44 7548 236 650
mobile (Finland): +358 45 640 2013
skype: alexlittleou
twitter: @alexlittle

anthk...@gmail.com

unread,
Oct 9, 2016, 2:00:42 PM10/9/16
to Learning Locker
Hey Alex,
I actually just did a video on this process (installing Learning Locker on AWS from a Mac) in case it might help others. It's currently processing in YouTube. When it's done, it'll be available here: https://youtu.be/51Dci7B49xA

Alex Little

unread,
Oct 9, 2016, 2:21:23 PM10/9/16
to learnin...@googlegroups.com

great - thanks!


On 09/10/16 21:00, anthk...@gmail.com wrote:
Hey Alex,
I actually just did a video on this process (installing Learning Locker on AWS from a Mac) in case it might help others. It's currently processing in YouTube. When it's done, it'll be available here: https://youtu.be/51Dci7B49xA


Reply all
Reply to author
Forward
0 new messages