MCrypt 在 Ubuntu 升级到13.10之后就不存在了

在我将我的系统从 Ubuntu 13.04升级到13.10之后,apache、 mysql 和 php 配置出现了一些问题。

我解决了大部分问题,但似乎不能让 mCrypt 库工作。 软件包已经安装,所以我不需要 apt-get 它。服务器工作正常,一切看起来都很正常,但是当我尝试用 Laravel4运行 php artisan serve时,我得到一条消息,需要 mCrypt。

我做了 php --ri mcrypt,输出是 Extension 'mcrypt' not present. 我试过把 extension=mcrypt.so放到 /etc/php5/apache2/php.ini上,但是没有用。

有什么想法吗?

dpkg --get-selections | grep php5输出

libapache2-mod-php5         install
php5                        install
php5-cli                    install
php5-common                 install
php5-gd                     install
php5-json                   install
php5-mcrypt                 install
php5-mysql                  install
php5-readline               install
84263 次浏览

I think I found the solution at launchpad.net.

sudo ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available
sudo php5enmod mcrypt
sudo service apache2 restart

This worked for me.

Another solution if the package is already installed:

sudo aptitude reinstall php5-mycript

This worked for me after doing upgrade

I also have this problem with Ubuntu 14.04 after install.

First enable the mcrypt

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

Add this command in any line

extension=mcrypt.so

Create conf.d folder in /etc/php5

sudo mkdir conf.d

And inside that folder create mcrypt.ini file

sudo gedit mcrypt.ini

Then add this command to that file

extension=mcrypt.so

Then create a link to file

sudo ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available

Enable mcrypt module

sudo php5enmod mcrypt

Restart apache

sudo service apache2 restart

I had this problem with Ubuntu 14.04 and I did the following to resolve it:

sudo apt-get install php5-mcrypt
sudo php5enmod mcrypt


sudo service apache2 restart

From Ubuntu 13.10 to 14.04:

sudo php5enmod mcrypt
sudo service apache2 restart

Works for me.

Try this code:

ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/apache2/conf.d/20-mcrypt.ini
service apache2 restart

I had the same problem with PHP 5.5.14 running on Mac OS X Yosemite. I was trying to install Laravel 5.0. And when I tried to create a new project I got an error like below (even when I tried to start the laravel server with php artisan serve

Alejandros-MacBook-Pro:Documents Lexynux$ laravel new blog
Crafting application...
PHP Notice:  Use of undefined constant MCRYPT_RIJNDAEL_128 - assumed 'MCRYPT_RIJNDAEL_128' in /Library/WebServer/Documents/blog/config/app.php on line 83
PHP Notice:  Use of undefined constant MCRYPT_RIJNDAEL_128 - assumed 'MCRYPT_RIJNDAEL_128' in /Library/WebServer/Documents/blog/config/app.php on line 83
Generating optimized class loader
Compiling common classes
Compiling views
PHP Notice:  Use of undefined constant MCRYPT_RIJNDAEL_128 - assumed 'MCRYPT_RIJNDAEL_128' in /Library/WebServer/Documents/blog/config/app.php on line 83
Application key [CCOPocoMjnJTx4AFXk64wqyTKyo3BlHq] set successfully.
Application ready! Build something amazing.
Alejandros-MacBook-Pro:Documents Lexynux$

So I just added the line below at the end of my php.ini file with the nano editor:

extension=mcrypt.so
sudo nano /etc/php.ini

Finally just restart the Terminal and restart the laravel app server with

php artisan serve

And it works fine!

just found on php.net

Note, for Ubuntu, simply installing php5-mcrypt did not get mcrypt to work. You need to execute the following commands as root to enable it:

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

http://php.net/manual/en/mcrypt.installation.php#114609

Sometimes, this "problem" occurs because you entered an artisan command on your local machine instead of on your virtual machine. If you are using Homestead, mcrypt is already installed. Consider it a reminder to homestead ssh

I also had this problem with Ubuntu 14.04 and Nginx,but the tip for me was restart the FPM service, so I did:

Install the library

apt-get install php5-mcrypt

Find the path

updatedb && locate mcrypt.so

Set the path of mcrypt.so inside the mcrypt.ini file located in /etc/php5/mods-available/mcrypt.ini

extension=/usr/lib/php5/20121212/mcrypt.so

And then restart the FPM service

service php5-fpm restart