Mcrypt PHP extension required in Laravel [duplicate]

落花浮王杯 提交于 2019-12-05 02:29:34

问题


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


回答1:


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.




回答2:


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!



来源:https://stackoverflow.com/questions/23562565/mcrypt-php-extension-required-in-laravel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!