Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Brian Bush
Brian Bush
4,398 Points

Mycrpt PHP extension required

I am trying my hardest to get laravel working on my mac, but every time I run the command "php artisan serve" it tells me that I don't have mcrypt.

mcrypt -v gives me -> Mcrypt v.0.9.9 (i386-apple-darwin13.1.0)

I have tried 5-6 different ways people have said to fix it but nothing works. I have been trying to get this working for 3 hours now. I'm to the point I'm about to dump the idea of using a framework, cause this is way too much hassle

2 Answers

Hey!

I had issues with mcrypt - I too have just got laravel up and running and had to deal with the same stuff. Have you run into any mysql issues also?

I installed php via brew and initiated a new app via composer. It was upon initiating a new app where I got a warning about mycrypt. In the end, added an entry to my bash profile which points php to the MAMP install instead of a general install. Have you got it fixed now?

Brian Bush
Brian Bush
4,398 Points

I tried doing this but I don't know if I know exactly how to edit my bash profile?

Ah no worries. It took me ages to work it out - I think the bash profile is something like your unique user settings. You'll find it here:

type in terminal

cd ~/

then

ls -a

and you should see a file called .bash_profile. I open this simply by saying

open .bash_profile

but if you want to use a specific program/text editor you'll have to look up how to call it to open a file. You could use the nano text editor in terminal. To do this:

nano .bash_profile

To save and quit the nano text editor, press CONTROL + O to save, then press ENTER. You'll then need to quit nano by CONTROL + X.

You can edit the bash profile from anywhere if you write

nano ~/.bash_profile

Hope this helps!

Brian Bush
Brian Bush
4,398 Points

I added that path to my bash profile towards the bottom, but it still says mcrypt is required. I have 4 different php file folders in mamp, don't know if that matters?

Brian Bush
Brian Bush
4,398 Points

Nevermind, I restarted the terminal and it works now, thanks for the help!!!

Sweet! No worries

I just thought I'd add this because this was the next thing I struggled with..

You may be set up already but if you're working with databases, make sure you have mysql installed:

in terminal type

mysql

If you go into mysql prompt, you're ready to go. If you don't, you'll need to install mysql (I did it via homebrew).

When you've got to this stage, make sure you have the server running:

mysql.server start

and everything should work. You'll need to create a database and a user for the app to work. If you're not the root user, you'll need to start mysql prompt using

sudo mysql

type your password and you should have the right permissions to get creating a database and user.

Sorry if you've already done this! Just thought it might be helpful.

EDIT: If you're still having issues connecting, in your database file inside the laravel app (Where all you db info is held), try changing localhost to 127.0.0.1 .

geoffrey
geoffrey
28,736 Points

I got the same problem yesterday because I also want to use Laravel. It seems from what you write Mcrypt is indeed installed. But is it enabled in PHP ?

For this, create a file named as exemple info.php in your localhost and include in this one these lines.

     <?php
        phpinfo();
     ?>

Then check go to localhost/info.php and see inside if mcrypt is enabled. CTRL+F => look for mcrypt there is a table for it. And there you can see If It's enabled !

Brian Bush
Brian Bush
4,398 Points

Mcrypt says that it is enabled