0

I've installed Laravel on a fresh install of Xubuntu 14.04. Mcrypt is installed and functioning as far as I can tell, but Laravel still reports that it cannot find it.

Testing Mcrypt

I have all the right packages installed and the module appears to have been enabled, I determined this by doing some basic diagnostic checks.

Mcrypt is in the list of installed php modules when I run:

php -m

I get "Loaded" from the terminal when I run:

php -r 'echo PHP_EOL . (extension_loaded("mcrypt") ? "loaded" : "not loaded") . PHP_EOL . PHP_EOL;'

This is the output of php -i | grep mcrypt:

/etc/php5/cli/conf.d/20-mcrypt.ini,
Registered Stream Filters => zlib.*, bzip2.*, convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk, mcrypt.*, mdecrypt.*
mcrypt
mcrypt support => enabled
mcrypt_filter support => enabled
mcrypt.algorithms_dir => no value => no value
mcrypt.modes_dir => no value => no value
PWD => /var/www/html/mcrypttest
_SERVER["PWD"] => /var/www/html/mcrypttest

Installing Laravel

I used a fresh installation of Laravel to test this on, by running:

git clone https://github.com/laravel/laravel mcrypttest
cd mcrypttest/
composer install

Can anyone suggest how to diagnose why Laravel cannto access mcrypt?

  • 1
    is there a chance php via command line is using different config to php via http? Run a webpage with `` and check there? – Laurence Oct 12 '14 at 13:13
  • Perhaps one of the answers in this question can help you. http://stackoverflow.com/questions/16830405/laravel-requires-the-mcrypt-php-extension – Patrick Reck Oct 12 '14 at 13:17
  • I had to manually add mcrypt to the apache2 php.ini, this would explain why the command line and composer could use PHP with mcrypt, but the browser couldn't. Cheers! – SamuelTurner Oct 12 '14 at 13:49

1 Answers1

0

Answer found here: https://stackoverflow.com/a/26168868/3060414

fixing the browser error (if you are having mcrypt error in browser when accessing local laravel index page)

sudo nano /etc/php5/apache2/php.ini

add the following line under the dynamically compiled extensions section of php ini

extension=mcrypt.so

restart the apache server , purge the laravel cache and everything working

Community
  • 1
  • 1