Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error installing php5-mcrypt

Just today I signed up with Google Cloud Compute Engine. I did everything but then I stuck into an error while installing php5-mcrypt extension. Error:

root@instance-2:~# sudo apt-get install php5-mcrypt
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 php5-mcrypt : Depends: phpapi-20121212
               Depends: php5-common (= 5.5.24+dfsg-1+deb.sury.org~vivid+1) but 5.6.4+dfsg-4ubuntu6 is to be installed
E: Unable to correct problems, you have held broken packages.

I searched everywhere and then I came here. Please help.

like image 409
Aditya Giri Avatar asked May 17 '15 09:05

Aditya Giri


People also ask

How do I install php5-mcrypt?

Also on Ubuntu, make sure you actually have php5-mcrypt installed. You can install it with: Using PHP version "PHP Version 5.3.10-1ubuntu3.4" and Ubuntu 12.0.4 on Apache2... Make sure you have mcrypt installed and active on your php5 install. Use "sudo apt-get install php5-mcrypt" to install, that should sort the issue.

Why can't I install the mcrypt extension in PHP?

This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package 'php-mcrypt' has no installation candidate The mcrypt extension was moved to the PECL repository and is no longer bundled with PHP as of PHP 7.2.0.

How to install PHP7 in Ubuntu 16 04?

The command sudo apt-get install lamp-server^ in Ubuntu 16.04 searches the package list files for all Task: fields and gets all with lamp-server, among them is php7.0. Then it installs those packages the standard way with sudo apt-get install package1 package2...

What happened to the mcrypt extension?

The mcrypt extension was moved to the PECL repository and is no longer bundled with PHP as of PHP 7.2.0. PECL is a repository for all known PHP extensions where users can download and host developed PHP extensions. Tell your OS to pull the latest list of packages available in repositories for installation:


1 Answers

sudo service apache2 restar

apt-get install php5-common 

Or, if you dont need to keep configurations:

apt-get purge php5-common
apt-get install php5-common

Do you get any output from apt-mark showhold?

If it does not solve your problem, you should try install it with aptitude:

sudo apt-get install aptitude
sudo aptitude install php5-mcrypt

Finally reatast the server

sudo service apache2 restart
like image 119
Gabriel Moretti Avatar answered Sep 21 '22 09:09

Gabriel Moretti