37

I am trying to create a laravel project with this:

Nicoles-MacBook-Pro:htdocs nicolekajatt$ composer create-project laravel/laravel guia-telefonica

And i am getting this:

Mcrypt PHP extension required.
Script php artisan clear-compiled handling the post-install-cmd event returned with an error



  [RuntimeException]  
  Error Output:       



create-project [-s|--stability="..."] [--prefer-source] [--prefer-dist] [--repository-url="..."] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-scripts] [--no-progress] [--keep-vcs] [--no-install] [package] [directory] [version]

I have tried this tutorial to fix this but the problem stills http://laravel.io/forum/02-08-2014-difficulty-installing-laravel-getting-error-mcrypt-php-extension-required?page=1

What can i do? Thanks for the help

frankzk
  • 556
  • 2
  • 6
  • 14

5 Answers5

53

Following steps were helpful for me on Ubuntu:

  1. Install php5-mcrypt using:

    apt-get install php5-mcrypt

  2. Activate mcrypt extension:

    php5enmod mcrypt

  3. Make sure it is loaded:

    php -i | grep mcrypt

you should see mcrypt support => enabled if it is activated.

j809
  • 1,499
  • 1
  • 12
  • 22
Max
  • 659
  • 4
  • 3
6

If you are on a Macintosh, try tho following:

cd ~ ; mkdir mcrypt ; cd mcrypt

Get libmcrypt 2.5.8 from Sourceforge.

Get the php code in a tar.gz or .bz2 format - (find your version of PHP by running php -v)

Move both of these files that you downloaded into your working directory – mcrypt in this instance and go back to Terminal

cd ~/mcrypt

Expand both files by double clicking on them in the Finder.

Remove the compressed archives

Change directory into libmcrypt

cd libmcrypt-2.5.8

./configure

make

sudo make install

With the libmcrypt configured and libraries now installed, time for to make the mcrypt extension.

If you see any Autoconf Errors

cd ~/mcrypt
curl -O http://ftp.gnu.org/gnu/autoconf/autoconf-latest.tar.gz
tar xvfz autoconf-latest.tar.gz
cd autoconf-2.69/
./configure
make
sudo make install

Compile mcrypt php Extension

cd ../php-5.4.17/ext/mcrypt/
/usr/bin/phpize
./configure
make
sudo make install

Open /etc/php.ini and add the line below at the end

extension=mcrypt.so

If there is no php.ini file, then you need to make one from php.ini.default in the same location like so:

sudo cp /etc/php.ini.default /etc/php.ini

And allow write capability

sudo chmod u+w  /etc/php.ini

Then add the line as above in your favourite text editor:

sudo nano /etc/php.ini

Finally Restart Apache

sudo apachectl restart

Now you should be able to install Laravel.

SOURCE: http://coolestguidesontheplanet.com/install-mcrypt-php-mac-osx-10-9-mavericks-development-server/

Sunny R Gupta
  • 5,026
  • 1
  • 31
  • 40
  • I did all the above, but I am still getting Mcrypt PHP extension required. Do you think this is because I am running MAMP, which is using another PHP and it is running on localhost:8888? The reason why ask, is because when I go localhost/mphpinfo.php - it is not running the php interpreter - all I see is - However, if I go to localhost:8888/mphpinfo.php, then I can see that mcrypt is available – kronus Nov 22 '14 at 17:38
  • You can easily find out which version of PHP is being called from any directory using `which php` in the command line. – Sunny R Gupta Nov 23 '14 at 10:28
  • 1
    I was able to get laravel installed without those errors by doing the following - I installed php 5.6.3 and libmcrypt-2.5.8 within the directory mcrypt under my ~/ and prior to that I fixed the openssl warnings by uncommenting openssl in my php.ini Bottom line is that I am no longer having the issue listed above and now I am trying to figure out how to keep localhost:8000 alive - [see my post here | http://laravel.io/forum/11-22-2014-notfoundhttpexception-and-php-artisan-serve-will-not-stay-up?page=1#reply-17386] Thanks for the help – kronus Nov 24 '14 at 13:49
0

If you are using Macports, this works: via http://rowdydesign.com/blog/2014/04/using-php-composer-under-mac-os-x-with-macports

run in Terminal

sudo ln -s /opt/local/bin/php54 /opt/local/bin/php
sudo ln -s /opt/local/bin/php-config54 /opt/local/bin/php-config
sudo ln -s /opt/local/bin/phpize54 /opt/local/bin/phpize

and change php54 to whatever version of php you are using, ie php53, php55

Carey Estes
  • 1,534
  • 2
  • 31
  • 59
0

On OS X, you can install the mcrypt extension via Homebrew, i.e.

$ brew install php56-mcrypt

(You may want to brew search mcrypt to find the version appropriate for your version of PHP.)

After doing this, composer ran successfully for me.

Waleed Khan
  • 11,426
  • 6
  • 39
  • 70
0

Use this command to create project

composer create-project --prefer-dist laravel/laravel blog "5.2.*"

Jose Wamba
  • 31
  • 2