3

I'm trying to install Laravel on Linux Ubuntu. I'm running Ubuntu 14.10.

Everything worked alright. But now instead of getting the supposed page when accessing localhost I get the message: " Mcrypt PHP extension required " I'm copying some information from terminal to help pinpoint the problem.

 which php
/usr/bin/php

php --ini
Configuration File (php.ini) Path: /etc/php5/cli
Loaded Configuration File:         /etc/php5/cli/php.ini
Scan for additional .ini files in: /etc/php5/cli/conf.d
Additional .ini files parsed:      /etc/php5/cli/conf.d/05-opcache.ini,
/etc/php5/cli/conf.d/10-pdo.ini,
/etc/php5/cli/conf.d/20-json.ini,
/etc/php5/cli/conf.d/20-mcrypt.ini,
/etc/php5/cli/conf.d/20-mysql.ini,
/etc/php5/cli/conf.d/20-mysqli.ini,
/etc/php5/cli/conf.d/20-pdo_mysql.ini,
/etc/php5/cli/conf.d/20-readline.ini

php -v
PHP 5.5.9-1ubuntu4 (cli) (built: Apr  9 2014 17:11:57) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies

php -m
mcrypt

The command php -m says that I have mcrypt module, but if I load a page containing

<?php phpinfo(); ?>

I can't see any mcrypt module. I only see mcrypt on the "Module Authors".

I don't know how to get Laravel to work...

Any help would be greatly appreciated.

Best regards

belyid
  • 841
  • 2
  • 12
  • 28
  • 1
    That's the ini file for command line, what about the ini file for your web access? They can be different. – Mark Baker May 09 '14 at 10:42
  • Remember that the command line PHP runs a different interpreter to the one used for your web server. ! – EquinoxMatt May 09 '14 at 10:42
  • @MarkBaker how do I check the ini file used on web access? – belyid May 09 '14 at 10:44
  • @belyid, execute phpinfo() in a file on the website, instead of command line, and see which ini file is being loaded. – EquinoxMatt May 09 '14 at 10:47
  • @MarkBaker I can't see the module mcrypt on phpinfo() page. – belyid May 09 '14 at 10:49
  • Yes but your phpinfo page will show you which config file is being loaded – EquinoxMatt May 09 '14 at 10:50
  • It's probably in a `/etc/php5/apache2` folder if you're using Apache; but a web page showing the phpinfo output would also tell you – Mark Baker May 09 '14 at 10:50
  • @MarkBaker you were correct it was using a different ini file. An empty one actually. I copied the file from /etc/php5/mods-available restarted the apache and now I get Error in exception handler – belyid May 09 '14 at 10:59

2 Answers2

5

Installing the php5-mcrypt doesn't automatically enable the module. Maybe you have to enable it manually:

Install the module

apt-get install php5-mcrypt

Create an auxialiar symlink and enable the module

cd /etc/php5/mods-available
ln -sf ../conf.d/mcrypt.ini .
php5enmod mcrypt

And reload apache

service apache2 reload

Hope it helps!

gyss
  • 1,753
  • 4
  • 23
  • 31
0

You need to check which ini file is being loaded. PHP CLI, and PHP server can sometimes run different config files.

Create a page with:

    <?php echo phpinfo(); ?>

then see which ini file is being loaded.