Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use of undefined constant MCRYPT_RIJNDAEL_128 - assumed 'MCRYPT_RIJNDAEL_128'

I have successfully installed Laravel, but after running php artisan serve and going to localhost:8000 I get this error:

Use of undefined constant MCRYPT_RIJNDAEL_128 - assumed 'MCRYPT_RIJNDAEL_128'

I have checked phpinfo() on localhost:8888 and it says that mcrypt is properly installed. However the only thing I can think of is that maybe my path is wrong?

in my .bash_profile I have

PATH=/usr/local/bin:$PATH

Every time I try to run Laravel commands I have to type this in the terminal:

export PATH="~/.composer/vendor/bin:$PATH" 

I am running on a Mac. Is there a simple way I can set up my bash_profile so that I can consistently change between localhost addresses and still have all the proper PHP functions working?

like image 522
Philip Avatar asked May 01 '15 19:05

Philip


2 Answers

More simple way on ubuntu

  • apt-get install php5-mcrypt
  • mv -i /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available/
  • php5enmod mcrypt
  • service apache2 restart

Note: if you don't have "/etc/php5/conf.d" just skip that step and it will work ok

check http://php.net/manual/en/mcrypt.installation.php

like image 145
Eslam Mahmoud Avatar answered Oct 25 '22 23:10

Eslam Mahmoud


This problem relative to the PHP extensions loader. You no need to use laravel command at all after successful installation. Laravel framework need Mcrypt Library for the security module and encrypt some of configure file.

The things that you need is theses steps.

  1. Download Mcrypt http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz/download

then configure make and install it.

  1. Download php http://php.net/releases/index.php Above 5.5.14 are suggested. (Use this path later on step 4)

  2. then download Autoconfigure

    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
    
  3. then you have to go to directory level

    cd ***YOURPHPDIRECTORY***/ext/mcrypt/
    

    and run phpize within this directory level

    /usr/bin/phpize
    ./configure
    make
    sudo make install
    
  4. modify your php.ini to enable the mcrypt extension by insert this into php.ini

    extension=mcrypt.so
    
  5. Restart web server.
like image 35
ZenithS Avatar answered Oct 26 '22 00:10

ZenithS