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?
For Mac users's specially - install it using Home Brew
I’ve installed an empty Laravel installation and got the following error message when navigating to http://localhost/kanban/public/:
Notice: Use of undefined constant MCRYPT_RIJNDAEL_128 – assumed ‘MCRYPT_RIJNDAEL_128′ in /Library/WebServer/Documents/xxx/config/app.php on line 83
Googling for this error message return many tutorials on how to install mcrypt on Mac OS X (whether building it from source or using Homebrew). The problem was that both the mcrypt and the php55-mcrypt packages were properly installed:
Mcrypt was also properly loaded by PHP:
for more details refer this link - http://benohead.com/mac-os-x-php-notice-use-undefined-constant-mcrypt_rijndael_128/
I just adjusted the
.bash_profile
in MacOS and it worked: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
I also had this problem in trying to deploy a
Laravel
toApache
onMac OS Sierra
. I eventually found this post that gave step-by-step instructions to resolve this issue. These instructions assume that you have Homebrew installed; if you don't have it installed, then paste the following into a Terminal window to install it:Here is the relevant steps pasted from the post given above:
Step 1: Install autoconf and mcrypt
I used homebrew to install autoconf and mcrypt, which is as easy as:
If this does not work for you, or you don't want to use homebrew, then check out this tutorial.
Step 2: Build the PHP extension
To build the PHP extension you will need the PHP 5.4.17 source code that is available for download here and extract it:
Then build the extension using the following commands:
Step 3: Enable the extension
All that is left is to enable the extension by editing /etc/php.ini. If this file is not present, copy /etc/php.ini.default and rename it:
Edit the /etc/php.ini file and add the following:
Step 4: Restart apache Now just restart apache and you're done!
ADDITIONAL NOTES AND CLARIFICATION
I did encounter two issues with following these steps:
PHP
zip file that I downloaded to the version of PHP that was installed on my machine.So I did
to determine the version number and then changed the download to match that version number. In my case the
PHP
version was 5.6.28 and so I needed to download the PHP source fromsudo make install
, the exception was caused by SIP, a security featured added byEl Capitan
. The exception is outlined in this question, and the resolution to this problem I found in this answer.Applying the information from this answer changed the step 2 listed above and replaced the
sudo make install
with the following:Take note that because of this change, step 4 above also needs to changed to include the path to
mcrypt.so
. So the following must go in thephp.ini
:If you are seeing this on ubuntu or other flavors of *nix , it might help to do the following:
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.
then configure make and install it.
Download php http://php.net/releases/index.php Above 5.5.14 are suggested. (Use this path later on step 4)
then download Autoconfigure
then you have to go to directory level
and run phpize within this directory level
modify your php.ini to enable the mcrypt extension by insert this into php.ini