Upgrading PHP on CentOS 6.5 (Final) - php

I'm trying to update my PHP (currently v:5.3.3 to the latest stable PHP build) but it's not playing ball and it's saying there is nothing to update.
Any help would be useful.
Keeps saying:
No Packages marked for Update

As Jacob mentioned, the CentOS packages repo appears to only have PHP 5.3 available at the moment. But these commands seemed to work for me...
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
yum remove php-common # Need to remove this, otherwise it conflicts
yum install php56w
yum install php56w-mysql
yum install php56w-common
yum install php56w-pdo
yum install php56w-opcache
php --version # Verify version has been upgraded
You can alternatively use php54w or php55w if required.
CAUTION!
This may potentially break your website if it doesn't fully resolve all your dependencies, so you may need a couple of extra packages in some cases. See here for a list of other PHP 5.6 modules that are available.
If you encounter a problem and need to reset back to the default, you can use these commands:
sudo yum remove php56w
sudo yum remove php56w-common
sudo yum install php-common
sudo yum install php-mysql
sudo yum install php
(Thanks Fabrizio Bartolomucci)

For CentOS 6, PHP 5.3.3 is the latest version of PHP available through the official CentOS package repository. Keep in mind, even though PHP 5.3.3 was released July 22, 2010, the official CentOS 6 PHP package was updated November 24, 2013. Why? Critical bug fixes are backported. See this question for more information: "Why are outdated packages installed by yum on CentOS? (specifically PHP 5.1) How to fix?"
If you'd like to use a more recent version of PHP, Les RPM de Remi offers CentOS PHP packages via a repository that you can add to the yum package manager. To add it as a yum repository, follow the site's instructions.
Note: Questions of this variety are probably better suited for Server Fault.

I managed to install php54w according to Simon's suggestion, but then my sites stopped working perhaps because of an incompatibility with php-mysql or some other module. Even frantically restoring the old situation was not amusing: for anyone in my own situation the sequence is:
sudo yum remove php54w
sudo yum remove php54w-common
sudo yum install php-common
sudo yum install php-mysql
sudo yum install php
It would be nice if someone submitted the full procedure to update all the php packet. That was my production server and my heart is still rapidly beating.

This is the easiest way that worked for me: To install PHP 5.6 on CentOS 6 or 7:
CentOS 6. Enter the following commands in the order shown:
yum -y update
yum -y install epel-release
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
wget https://centos6.iuscommunity.org/ius-release.rpm
rpm -Uvh ius-release*.rpm
yum -y update
yum -y install php56u php56u-opcache php56u-xml php56u-mcrypt php56u-gd php56u-devel php56u-mysql php56u-intl php56u-mbstring php56u-bcmath
CentOS 7. Enter the following commands in the order shown:
yum -y update
yum -y install epel-release
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
wget https://centos7.iuscommunity.org/ius-release.rpm
rpm -Uvh ius-release*.rpm
yum -y update
yum -y install php56u php56u-opcache php56u-xml php56u-mcrypt php56u-gd php56u-devel php56u-mysql php56u-intl php56u-mbstring php56u-bcmath
Sorry - I'm unable to post the source URL - due to reputation

Verify current version of PHP
Type in the following to see the current PHP version:
php -v
Should output something like:
PHP 5.3.3 (cli) (built: Jul 9 2015 17:39:00)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
Install the Remi and EPEL RPM repositories
If you haven’t already done so, install the Remi and EPEL repositories
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm && rpm -Uvh epel-release-latest-6.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm && rpm -Uvh remi-release-6*.rpm
Enable the REMI repository globally:
nano /etc/yum.repos.d/remi.repo
Under the section that looks like [remi] make the following changes:
[remi]
name=Remi's RPM repository for Enterprise Linux 6 - $basearch
#baseurl=http://rpms.remirepo.net/enterprise/6/remi/$basearch/
mirrorlist=http://rpms.remirepo.net/enterprise/6/remi/mirror
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
Also, under the section that looks like [remi-php55] make the following changes:
[remi-php56]
name=Remi's PHP 5.6 RPM repository for Enterprise Linux 6 - $basearch
#baseurl=http://rpms.remirepo.net/enterprise/6/php56/$basearch/
mirrorlist=http://rpms.remirepo.net/enterprise/6/php56/mirror
# WARNING: If you enable this repository, you must also enable "remi"
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
Type CTRL-O to save and CTRL-X to close the editor
Upgrade PHP 5.3 to PHP 5.6
Now we can upgrade PHP. Simply type in the following command:
yum -y upgrade php*
Once the update has completed, let’s verify that you have PHP 5.6 installed:
php -v
Should see output similar to the following:
PHP 5.6.14 (cli) (built: Sep 30 2015 14:07:43)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies

Steps for upgrading to PHP7 on CentOS 6 system. Taken from install-php-7-in-centos-6
To install latest PHP 7, you need to add EPEL and Remi repository to your CentOS 6 system
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
yum install http://rpms.remirepo.net/enterprise/remi-release-6.rpm
Now install yum-utils, a group of useful tools that enhance yum’s default package management features
yum install yum-utils
In this step, you need to enable Remi repository using yum-config-manager utility, as the default repository for installing PHP.
yum-config-manager --enable remi-php70
If you want to install PHP 7.1 or PHP 7.2 on CentOS 6, just enable it as shown.
yum-config-manager --enable remi-php71
yum-config-manager --enable remi-php72
Then finally install PHP 7 on CentOS 6 with all necessary PHP modules using the following command.
yum install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo
Double check the installed version of PHP on your system as follows.
php -V

IUS offers an installation script for subscribing to their repository and importing associated GPG keys. Make sure you’re in your home directory, and retrieve the script using curl:
curl 'https://setup.ius.io/' -o setup-ius.sh
sudo bash setup-ius.sh
Install Required Packages-:
sudo yum install -y mod_php70u php70u-cli php70u-mysqlnd php70u-json php70u-gd php70u-dom php70u-simplexml php70u-mcrypt php70u-intl

Related

`phpize' failed, while installing Imagick [duplicate]

I have been meaning to install ffmpeg as an extension to my PHP setup. So before I can install it, I need to phpize it. I installed php5-dev by sudo apt-get install php5-dev. But now when I run phpize I get the following error :
phpize
Cannot find config.m4.
Make sure that you run '/usr/bin/phpize' in the top level source directory of the module
The location of my php.ini is /usr/local/zend/etc/php.ini
From another online resource I tried this
sudo apt-get install autoconf automake libtool m4
But all of them are already installed.
Locate config.m4 didn't return anything.
Any pointers here how I can get phpize and thus, ffmpeg up and running?
For recent versions of Debian/Ubuntu (Debian 9+ or Ubuntu 16.04+) install the php-dev dependency package, which will automatically install the correct version of php{x}-dev for your distribution:
sudo apt install php-dev
Older versions of Debian/Ubuntu:
For PHP 5, it's in the php5-dev package.
sudo apt-get install php5-dev
For PHP 7.x (from rahilwazir comment):
sudo apt-get install php7.x-dev
RHEL/CentOS/yum
yum install php-devel # see comments
For PHP7 Users
7.1
sudo apt install php7.1-dev
7.2
sudo apt install php7.2-dev
7.3
sudo apt install php7.3-dev
7.4
sudo apt install php7.4-dev
If not sure about your PHP version, simply run command php -v
Ohk.. I got it running by typing /usr/bin/phpize instead of only phpize.
Under Redhat Enterprise / CentOS, use yum to install the php-devel module:
yum install php-devel
For PHP 7, you need:
yum install php70-php-devel
Step - 1: If you are unsure about the php version installed,
then first run the following command in terminal
php -v
Output: the above command will output the php version installed on your machine, mine is 7.2
PHP 7.2.3-1ubuntu1 (cli) (built: Mar 14 2018 22:03:58) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.3-1ubuntu1, Copyright (c) 1999-2018, by Zend Technologies
Step 2: Then to install phpize run the following command, Since my php version is 7.2.3. i will replace it with 7.2, so the command will be,
sudo apt-get install php7.2-dev
Step 3: Done!
Alternate method(Optional):
To automatically install the phpize version based on the php version installed on your machine run the following command.
sudo apt-get install php-dev
This command will automatically detect the appropriate version of php installed and will install the matching phpize for the same.
Hmm... actually i dont know how this solved it? But the following steps solved it for me:
find / -name 'config.m4'
Now look if the config.m4 is anywhere in a folder of that stuff you want to phpize. Go to that folder and run phpize directly in there.
For ubuntu 14.04LTS with php 7, issue:
sudo apt-get install php-dev
Then install:
pecl install memcache
In Ubuntu 16.04, you can install phpize with the command
aptitude install php7.1-dev // for php 7.1
which is equivalent to
apt-get install php7.1-dev // for php 7.1
If you're having problems with phpize not found on CentOS7.x after you have installed the relevant devel tools for your version/s of PHP, this path finally worked for me:
For PHP 7.2.x
/opt/cpanel/ea-php72/root/usr/bin/phpize
For PHP 7.3.x
/opt/cpanel/ea-php73/root/usr/bin/phpize
For PHP 7.4.x
/opt/cpanel/ea-php74/root/usr/bin/phpize
Run this in your folder containing the downloaded PHP extension, for example in line 3 below:
Example based on installing the PHP v7.3.x Brotli Extension from https://github.com/kjdev/php-ext-brotli
git clone --recursive --depth=1 https://github.com/kjdev/php-ext-brotli.git
cd /php-ext-brotli
/opt/cpanel/ea-php73/root/usr/bin/phpize
./configure --with-php-config=/opt/cpanel/ea-php73/root/usr/bin/php-config
make
make test
Install from linux terminal
sudo apt-get install <php_version>-dev
Example :
sudo apt-get install php5-dev #For `php` version 5
sudo apt-get install php7.0-dev #For `php` version 7.0
Of course in PHP7.2
sudo apt-get install php7.2-dev
This might help someone on ubuntu. No promises.
sudo apt-get install libcurl3 php5-dev libcurl4-gnutls-dev libmagic-dev
sudo apt-get install php-http make
sudo pecl install pecl_http
And adding "extension=http.so" to php.ini (Normally located at /etc/php5/apache2/php.ini)
Then restart Apache (sudo service apache2 restart).
If in doubt, check your apache logs:
sudo su --
cd /var/log/apache2
tail -25 error.log
Is http.so starting or failing?
For instance, if you wanted to use the "phpize" command for PHP 5.6, you would use the full path:
Code:
/opt/cpanel/ea-php56/root/usr/bin/phpize
For ubuntu with Plesk installed run apt-get install plesk-php56-dev, for other versions just change XX in phpXX (without the dot)
Go to the downloaded folder and there you find config.m4. Open the terminal and run phpsize.
I had this exact problem on macOS in 2018.
For me, first running brew install php before sudo pecl install mongodb did the trick.
You didn't specify what operating system you're using, and 90% of the answers assume Ubuntu/Debian Linux because of the apt-get install autoconf automake libtool m4 command that you posted (and over half expect you to be running CPanel), so I'm giving you a slightly more generic solution which ought to work on any Un*x clone (including Microsoft's WSL!).
You will need at least a few prerequisites:
A working C/C++ compiler — GCC or clang being the most popular options these days.
A 'developer edition' of PHP, which some package managers call 'development headers'. In the case of aptitude, as shown on the other answers, you ought to be fine with just sudo apt install php-dev. Beware of the mentioned caveats: you might end up with a slightly more unstable version of PHP which might not be updated correctly with future versions.
These days (that's late 2021 for me!), for those running Ubuntu, and wishing to seriously tinker with PHP, the recommendation is to use Ondřej Surý's personal package archive for PHP. Ondřej keeps his PPA always up to date, sometimes within a few hours after release; he keeps up with the latest four Ubuntu distributions and all the currently supported PHP versions that haven't reached end-of-life status yet (sorry, PHP5 is considered completely obsolete and plagued with unpatched bugs and security issues, so it's not supported — for very good reasons!); and he provides a lot of PHP extensions, too. Sadly, ffmpeg-php is not one of them...
There is a good reason for the overall lack of support of ffmpeg-php. Allegedly, the original repository for that was hosted at Sourceforge but has been abandoned in 2007. The recommended package these days is PHP-FFMpeg which is constantly being updated, and ought to be easily installed using composer — get it before starting your compilation!
Alternatively, instead of relying on an external non-official PHP extension (albeit one that is both popular and updated regularly!), you ought to launch the ffmpeg binary using shell_exec(). This is the officially recommended approach, mostly because converting videos always takes a long time, and the authors of that recommendation suggest a simple architecture where the PHP script basically launches ffmpeg in the background, accepting batches of videos for processing. The page is a bit old, but the technique shown is sound.
I am using XAMPP on Linux mint and it is by default installed if your don't have
sudo apt-get install php7.0-dev
// or
sudo apt-get install php-dev
know more

yum install mcrypt error [duplicate]

I have been trying to install php-mcrypt for a while now. Everytime I get the "No package php-mcrypt available." returned to me. Here's what I've tried:
root#ip-********** [~]# yum install php-mcrypt --enablerepo=centosplus (<- both with and without this)
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: p3plmirror01.prod.phx3.secureserver.net
* centosplus: p3plmirror01.prod.phx3.secureserver.net
* epel: mirrors.solfo.com
* extras: p3plmirror01.prod.phx3.secureserver.net
* updates: p3plmirror01.prod.phx3.secureserver.net
centosplus | 3.5 kB 00:00
centosplus/primary_db | 746 kB 00:00
Setting up Install Process
No package php-mcrypt available.
Error: Nothing to do
I have made sure to install the EPEL repository. At this point I'm just stumped. I've followed EVERY tutorial I've found online and get the same error.
Notes: GoDaddy VPS, CentOS 6.4 64-bit, mcrypt installed without a hitch, but no php-mcrypt.
I had the same issue, and found the previous suggestions gave me enough info to get it working on my server. The following is what I did:
1) Install EPEL repository (From: http://www.rackspace.com/knowledge_center/article/installing-rhel-epel-repo-on-centos-5x-or-6x):
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
sudo rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
2) Install it via:
yum update
yum install php-mcrypt*
The yum update updated the repository reference on my server then the 2nd command got what I needed :)
3) Restart your webserver. For my apache install I did:
service httpd restart
For me the answer was:
1) Get the Repos from
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
sudo rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
2) Install it via:
sudo yum update
sudo yum install php-mcrypt*
3) Edit the mcrypt.ini
sudo nano /etc/php.d/mcrypt.ini
add this
extension=/usr/lib64/php/modules/mcrypt.so
Finally
4) Restart your webserver:
sudo service httpd restart
I run this steps in CentOS 6.3 (64) on Azure From Microsoft Linux image
Hope it helps you.
Best Regards.
Updated Answer for centos 7
## RHEL/CentOS 7 64-Bit ##
# wget http://dl.fedoraproject.org/pub/epel/beta/7/x86_64/epel-release-7-0.2.noarch.rpm
# rpm -ivh epel-release-7-0.2.noarch.rpm
For CentOS 6
## RHEL/CentOS 6 32-Bit ##
# wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
# rpm -ivh epel-release-6-8.noarch.rpm
## RHEL/CentOS 6 64-Bit ##
# wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# rpm -ivh epel-release-6-8.noarch.rpm
Install
yum install php-mcrypt
Edit: See comments for updated repositories.
yum install php-mcrypt.x86_64
worked for me instead of
yum install php-mcrypt
I was able to figure this out; it was a lot simpler then I thought. Under the WHM manager go to: Home >> Software >> EasyApache (Apache Update) >> There you have two options "Build Profile" or "Customize Based On Profile". I went Customize to keep my current config then followed the instructions on the page.
Eventually there was a place to add and remove php modules. There you will find ever module under the sun. Just select the one you want and rebuild the profile. It was really that simple.
I got too much problem in installing php-mcrypt using epel-release-6-8.noarch.rpm. It has some dependency problem.
Then I tried in different way.
Get the php-mcrypt using "wget ftp://ftp.univie.ac.at/systems/linux/fedora/epel/6/x86_64/php-mcrypt-5.3.3-3.el6.x86_64.rpm" command.
Then install libmcrypt
ftp://ftp.pbone.net/mirror/download.fedora.redhat.com/pub/fedora/epel/6/x86_64/libmcrypt-2.5.8-9.el6.x86_64.rpm
The installed php-mcrypt using following command
yum install php-mcrypt-5.3.3-3.el6.x86_64.rpm
If php_mcrypt installed on 64bit but reported missing by an installer, check the extension path:
vi /etc/php.d/mcrypt.ini
; Enable mcrypt extension module
;extension=module.so
extension=/usr/lib64/php/modules/mcrypt.so
To install mcrypt from http://namhuy.net/641/centos-6-install-mcrypt-for-phpmyadmin.html
i386
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
x86_64
http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
then just use yum command to install the mcrypt package
yum install php-mcrypt
The best way is to:
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/php-mcrypt-5.3.3-3.el6.x86_64.rpm
yum localinstall php-mcrypt-5.3.3-3.el6.x86_64.rpm
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/libmcrypt-2.5.8-9.el6.x86_64.rpm
yum localinstall libmcrypt-2.5.8-9.el6.x86_64.rpm
or go to: http://dl.fedoraproject.org/pub/epel/6/x86_64/ to match your version
check from your info.php that is ok -- done!
There are two ways you can address this:
Download php-mcrypt from fedora:
http://injustfiveminutes.wordpress.com/2012/11/23/install-php-mcrypt-extension-on-rhel-6/
Check if you're facing a known bug with a wrongly packaged php-mcrypt extension:
http://www.sterndata.com/blog/phymyadmin-mcrypt-and-centos-6-mcrypt-extension-missing-solved
For me I had to add the EPEL repository. It is where my php-mcrypt came from:
[root#system ~]$ repoquery -i php-mcrypt
Name : php-mcrypt
Version : 5.3.3
Release : 1.el6
Architecture: i686
Size : 39225
Packager : Fedora Project
Group : Development/Languages
URL : http://www.php.net/
Repository : epel <----------
Summary : Standard PHP module provides mcrypt library support
Source : php-extras-5.3.3-1.el6.src.rpm
Description :
Standard PHP module provides mcrypt library support
You can enable the EPEL repo with the instructions here:
http://fedoraproject.org/wiki/EPEL
installing php-mcrypt from Repoforge worked for me perfectly. Just add Repoforge from http://repoforge.org/ and simply run yum install php-mcrypt.
For me, this worked :
yum install php-mcrypt*
and then, restart httpd service
service httpd restart
I tryed #VenomFangs solution but the first step was not needed for me. I already had a newer EPEL version installed. So, the first step following was not usefull, I backed to the snapshot I did before doing modifications and I just used the install and restart above commands.
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
sudo rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
CentOS Linux release 7.2.1511 (Core)
PS : I know this is not the subject, but if somebody needs it, the keyword can help. I needed to do this because of this error on prestashop. Two keywords I would be glad to use to find this informations are : "php_mycrypt.dll" "php_mcrypt.dll"
Fatal error: Call to undefined function mcrypt_encrypt() in /classes/Rijndael.php on line 46
EDIT 10/06/2016 :
Another Prestashop solution to try in "Advanced Parameters", "Performance", "Ciphering" (FR : Chiffrement), "Use the custom BlowFish class." instead of "Use Rijndael with mcrypt lib. (you must install the Mcrypt extension)."
First find out your PHP version. In my case 5.6.
php --version
PHP 5.6.27 (cli) (built: Oct 15 2016 21:31:59)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
Then:
sudo yum search mcrypt
And choose the best one for your version from the list, I used php56w-mcrypt.
$ sudo yum search mcrypt
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
..... output truncated ....
libmcrypt-devel.i686 : Development libraries and headers for libmcrypt
libmcrypt-devel.x86_64 : Development libraries and headers for libmcrypt
libtomcrypt-devel.i686 : Development files for libtomcrypt
libtomcrypt-devel.x86_64 : Development files for libtomcrypt
libtomcrypt-doc.noarch : Documentation files for libtomcrypt
php-mcrypt.x86_64 : Standard PHP module provides mcrypt library support
php55w-mcrypt.x86_64 : Standard PHP module provides mcrypt library support
# either of these are fine:
php56-php-mcrypt.x86_64 : Standard PHP module provides mcrypt library support
php56w-mcrypt.x86_64 : Standard PHP module provides mcrypt library support
php70-php-mcrypt.x86_64 : Standard PHP module provides mcrypt library support
php70w-mcrypt.x86_64 : Standard PHP module provides mcrypt library support
php71-php-mcrypt.x86_64 : Standard PHP module provides mcrypt library support
libmcrypt.i686 : Encryption algorithms library
libmcrypt.x86_64 : Encryption algorithms library
libtomcrypt.i686 : A comprehensive, portable cryptographic toolkit
libtomcrypt.x86_64 : A comprehensive, portable cryptographic toolkit
mcrypt.x86_64 : Replacement for crypt()
```
Finally:
sudo service httpd restart
I was having same issue in centos 6.5
Finaly solution below worked for me
-go to http://dl.fedoraproject.org/pub/epel/6/x86_64/
-search for php-mcrypt(http://dl.fedoraproject.org/pub/epel/6/x86_64/php-mcrypt-5.3.3-3.el6.x86_64.rpm)
-execute wget http://dl.fedoraproject.org/pub/epel/6/x86_64/php-mcrypt-5.3.3-3.el6.x86_64.rpm
-rpm -ivh php-mcrypt-5.3.3-3.el6.x86_64.rpm
if there are any dependencies you can download same using http://dl.fedoraproject.org/pub/epel/6/x86_64/
For php 7 to install mcrypt run:
Centos:
sudo yum install php7.0-mcrypt to install
On Ubuntu:
sudo apt-get install php7.0-mcrypt
If you want to recompile PHP with mcrypt enable.
1.
Insatll mcrypt. libmcrypt-devel is from Third Party Repositories EPEL, so you should:
yum --enablerepo=extras install epel-release
yum install libmcrypt-devel
2.
Append --with-mcrypt to your ./configure arguments:
./configure --with-mcrypt
3.
Build and install:
make & make install
Try
yum clean all
yum remove epel-release
yum install epel-release
and finally
yum install php-mcrypt

How to install a newer version of PHP than what Yum installs?

I have installed PHP by executing the following command:
yum install php
It installs PHP 5.3.3 in my server... but I want to install PHP 5.4. How can I do that?
Saw it on https://webtatic.com/packages/php54/
To install, first you must add the Webtatic EL yum repository information corresponding to your CentOS/RHEL version to yum:
CentOS/RHEL 7.x:
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
CentOS/RHEL 6.x:
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
CentOS/RHEL 5.x:
rpm -Uvh http://mirror.webtatic.com/yum/el5/latest.rpm
Now you can install php by doing:
yum install php54w
yum installs approved versions of packages. The approved version depends on a few things, such as your distribution and whether the package itself has been tested and deemed as working. This testing can sometimes lag well behind the development of the packages. Chances are that the version that you have installed is the latest approved version.
Building PHP isn't manually terribly difficult, so that's probably your best option. Uninstall the version you have from yum and checkout the official instructions on how to clone and build yourself.
Either that or look around for other packages in yum that give you a newer version (see #barbarity's answer).
Reference http://ahmed.amayem.com/replacing-yum-plugin-replace-one-yum-install-package-php-with-another-on-linux-centos-6/
Check available packages
rpm -q php
Installing the webtatic release RPM(For CentOs 6.x)
sudo rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
Check for available packages in other repo
yum info php55w
Trying to update using yum update
sudo yum update php
Updating using yum remove then yum install
yum info php-common
Removing php-common
sudo yum remove php-common
Installing php55w and php55w-common
sudo yum install php55w php55w-common
Now restart your apache server then check the php version.

How to Install Php5.6 in amazon linux

I'm trying to install php 5.6 on Amazon linux using the following command:
$ yum install php56
No package php56 available.
Error: Nothing to do
Is there a repository I need to add in order to do this? I've searched for this but couldn't find any source. I'd also like to know which Apache versions work with this version of php?
Below are the steps I have used to update PHP version from 5.3 to 5.6 in Amazon Linux
Steps (Use sudo only if required)
1) Remove OLD Apache
sudo service httpd stop
sudo yum erase httpd httpd-tools apr apr-util
2) Remove OLD PHP
sudo yum remove php-*
3) Install PHP 5.6 (Apache 2.4 will be automatically installed with this)
sudo yum install php56
4) Make sure all the required PHP extensions are installed
yum list installed | grep php
5) If not then install them using
sudo yum install php56-xml php56-xmlrpc php56-soap php56-gd
6) To list the other available php extensions
yum search php56
7) PHP 5.6 MySQL extension (Assume you have already installed MySQL)
sudo yum install php56-mysqlnd
(NOTE: it is not php56-mysql)
8) Start / Restart Apache
sudo service httpd start
sudo service httpd restart
9) Check the version
php -v
httpd -v
AWS has not yet packaged php 5.6. You need to install php 5.5 from the ALAMI repositories, or build 5.6 from source.
To list the available 5.5 packages use yum search php55
The php55 is the base package, but you may need others listed as well.
When 5.6 is ready, you'll be able to find it with
yum search php56
You can find information on building the source at php.net, specifically Installation on Unix Systems / Apache 2.x on Unix Systems
Just to mantain update the answers,
I tryed the proposed solution and didn't work.
Quite hard to install 5.6
I found the right command nowaday to install 7.2 is
amazon-linux-extras install php7.2
it install and upgrade everything without complications.
Try this:
sudo yum -y update
sudo yum install –y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo wget https://centos7.iuscommunity.org/ius-release.rpm
sudo rpm -Uvh ius-release*.rpm
sudo yum -y update
When you install the package you'll need to add a u to the end of php56. Here is an example of some packages you could install.
sudo yum -y install php56u php56u-opcache php56u-xml \
php56u-mcrypt php56u-gd php56u-devel php56u-mysql \
php56u-intl php56u-mbstring php56u-bcmath php56u-soap
Successfully installed php56 and required php-module on amazonlinux2 with the repo epo.ius.io.
sudo yum -y update
sudo yum install –y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
wget https://repo.ius.io/ius-release-el7.rpm
sudo rpm -Uvh ius-release*.rpm
sudo yum -y update
sudo yum install --enablerepo=ius-archive php56u php56u-opcache php56u-xml php56u-mcrypt php56u-gd php56u-devel php56u-mysql php56u-intl php56u-mbstring php56u-bcmath php56u-soap
Check PHP version with below command
[root#ip-10-10-1-47 ~]# php -v
PHP 5.6.40 (cli) (built: Jan 11 2019 10:27:04)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
To install php module
yum install --enablerepo=ius-archive php56u-{Module Name}
Validate the module name
php -m
php -m | grep {Module Name}
example to check php yaml module
php -m | grep yaml
Reference URL : https://forums.aws.amazon.com/thread.jspa?threadID=284157
Additional part from #Daniele post for resloving this problem.
This is more help than question, but to help other with problem which I had in my case. I need to install Wordpress site on EC2, but when I tried to run it with public IP address, it was problem. I tried to install php 5.6, but it was not possible.
I find solution to install php 7.2, using command:
**amazon-linux-extras install php7.2**
TO check that is really version php 7.2, use:
php -version or php -v
After this, you need to stop apache service, command for stop is:
service httpd stop
Start again apache service:
service httpd start
In your AWS console, go to Instance, find public IP address, copy and open in browser. You should see the WordPress page. You can install WordPress in Advanced part (bootstraping), when you create EC2 instance.

Install php-mcrypt on CentOS 6

I have been trying to install php-mcrypt for a while now. Everytime I get the "No package php-mcrypt available." returned to me. Here's what I've tried:
root#ip-********** [~]# yum install php-mcrypt --enablerepo=centosplus (<- both with and without this)
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: p3plmirror01.prod.phx3.secureserver.net
* centosplus: p3plmirror01.prod.phx3.secureserver.net
* epel: mirrors.solfo.com
* extras: p3plmirror01.prod.phx3.secureserver.net
* updates: p3plmirror01.prod.phx3.secureserver.net
centosplus | 3.5 kB 00:00
centosplus/primary_db | 746 kB 00:00
Setting up Install Process
No package php-mcrypt available.
Error: Nothing to do
I have made sure to install the EPEL repository. At this point I'm just stumped. I've followed EVERY tutorial I've found online and get the same error.
Notes: GoDaddy VPS, CentOS 6.4 64-bit, mcrypt installed without a hitch, but no php-mcrypt.
I had the same issue, and found the previous suggestions gave me enough info to get it working on my server. The following is what I did:
1) Install EPEL repository (From: http://www.rackspace.com/knowledge_center/article/installing-rhel-epel-repo-on-centos-5x-or-6x):
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
sudo rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
2) Install it via:
yum update
yum install php-mcrypt*
The yum update updated the repository reference on my server then the 2nd command got what I needed :)
3) Restart your webserver. For my apache install I did:
service httpd restart
For me the answer was:
1) Get the Repos from
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
sudo rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
2) Install it via:
sudo yum update
sudo yum install php-mcrypt*
3) Edit the mcrypt.ini
sudo nano /etc/php.d/mcrypt.ini
add this
extension=/usr/lib64/php/modules/mcrypt.so
Finally
4) Restart your webserver:
sudo service httpd restart
I run this steps in CentOS 6.3 (64) on Azure From Microsoft Linux image
Hope it helps you.
Best Regards.
Updated Answer for centos 7
## RHEL/CentOS 7 64-Bit ##
# wget http://dl.fedoraproject.org/pub/epel/beta/7/x86_64/epel-release-7-0.2.noarch.rpm
# rpm -ivh epel-release-7-0.2.noarch.rpm
For CentOS 6
## RHEL/CentOS 6 32-Bit ##
# wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
# rpm -ivh epel-release-6-8.noarch.rpm
## RHEL/CentOS 6 64-Bit ##
# wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# rpm -ivh epel-release-6-8.noarch.rpm
Install
yum install php-mcrypt
Edit: See comments for updated repositories.
yum install php-mcrypt.x86_64
worked for me instead of
yum install php-mcrypt
I was able to figure this out; it was a lot simpler then I thought. Under the WHM manager go to: Home >> Software >> EasyApache (Apache Update) >> There you have two options "Build Profile" or "Customize Based On Profile". I went Customize to keep my current config then followed the instructions on the page.
Eventually there was a place to add and remove php modules. There you will find ever module under the sun. Just select the one you want and rebuild the profile. It was really that simple.
I got too much problem in installing php-mcrypt using epel-release-6-8.noarch.rpm. It has some dependency problem.
Then I tried in different way.
Get the php-mcrypt using "wget ftp://ftp.univie.ac.at/systems/linux/fedora/epel/6/x86_64/php-mcrypt-5.3.3-3.el6.x86_64.rpm" command.
Then install libmcrypt
ftp://ftp.pbone.net/mirror/download.fedora.redhat.com/pub/fedora/epel/6/x86_64/libmcrypt-2.5.8-9.el6.x86_64.rpm
The installed php-mcrypt using following command
yum install php-mcrypt-5.3.3-3.el6.x86_64.rpm
If php_mcrypt installed on 64bit but reported missing by an installer, check the extension path:
vi /etc/php.d/mcrypt.ini
; Enable mcrypt extension module
;extension=module.so
extension=/usr/lib64/php/modules/mcrypt.so
To install mcrypt from http://namhuy.net/641/centos-6-install-mcrypt-for-phpmyadmin.html
i386
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
x86_64
http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
then just use yum command to install the mcrypt package
yum install php-mcrypt
The best way is to:
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/php-mcrypt-5.3.3-3.el6.x86_64.rpm
yum localinstall php-mcrypt-5.3.3-3.el6.x86_64.rpm
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/libmcrypt-2.5.8-9.el6.x86_64.rpm
yum localinstall libmcrypt-2.5.8-9.el6.x86_64.rpm
or go to: http://dl.fedoraproject.org/pub/epel/6/x86_64/ to match your version
check from your info.php that is ok -- done!
There are two ways you can address this:
Download php-mcrypt from fedora:
http://injustfiveminutes.wordpress.com/2012/11/23/install-php-mcrypt-extension-on-rhel-6/
Check if you're facing a known bug with a wrongly packaged php-mcrypt extension:
http://www.sterndata.com/blog/phymyadmin-mcrypt-and-centos-6-mcrypt-extension-missing-solved
For me I had to add the EPEL repository. It is where my php-mcrypt came from:
[root#system ~]$ repoquery -i php-mcrypt
Name : php-mcrypt
Version : 5.3.3
Release : 1.el6
Architecture: i686
Size : 39225
Packager : Fedora Project
Group : Development/Languages
URL : http://www.php.net/
Repository : epel <----------
Summary : Standard PHP module provides mcrypt library support
Source : php-extras-5.3.3-1.el6.src.rpm
Description :
Standard PHP module provides mcrypt library support
You can enable the EPEL repo with the instructions here:
http://fedoraproject.org/wiki/EPEL
installing php-mcrypt from Repoforge worked for me perfectly. Just add Repoforge from http://repoforge.org/ and simply run yum install php-mcrypt.
For me, this worked :
yum install php-mcrypt*
and then, restart httpd service
service httpd restart
I tryed #VenomFangs solution but the first step was not needed for me. I already had a newer EPEL version installed. So, the first step following was not usefull, I backed to the snapshot I did before doing modifications and I just used the install and restart above commands.
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
sudo rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
CentOS Linux release 7.2.1511 (Core)
PS : I know this is not the subject, but if somebody needs it, the keyword can help. I needed to do this because of this error on prestashop. Two keywords I would be glad to use to find this informations are : "php_mycrypt.dll" "php_mcrypt.dll"
Fatal error: Call to undefined function mcrypt_encrypt() in /classes/Rijndael.php on line 46
EDIT 10/06/2016 :
Another Prestashop solution to try in "Advanced Parameters", "Performance", "Ciphering" (FR : Chiffrement), "Use the custom BlowFish class." instead of "Use Rijndael with mcrypt lib. (you must install the Mcrypt extension)."
First find out your PHP version. In my case 5.6.
php --version
PHP 5.6.27 (cli) (built: Oct 15 2016 21:31:59)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
Then:
sudo yum search mcrypt
And choose the best one for your version from the list, I used php56w-mcrypt.
$ sudo yum search mcrypt
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
..... output truncated ....
libmcrypt-devel.i686 : Development libraries and headers for libmcrypt
libmcrypt-devel.x86_64 : Development libraries and headers for libmcrypt
libtomcrypt-devel.i686 : Development files for libtomcrypt
libtomcrypt-devel.x86_64 : Development files for libtomcrypt
libtomcrypt-doc.noarch : Documentation files for libtomcrypt
php-mcrypt.x86_64 : Standard PHP module provides mcrypt library support
php55w-mcrypt.x86_64 : Standard PHP module provides mcrypt library support
# either of these are fine:
php56-php-mcrypt.x86_64 : Standard PHP module provides mcrypt library support
php56w-mcrypt.x86_64 : Standard PHP module provides mcrypt library support
php70-php-mcrypt.x86_64 : Standard PHP module provides mcrypt library support
php70w-mcrypt.x86_64 : Standard PHP module provides mcrypt library support
php71-php-mcrypt.x86_64 : Standard PHP module provides mcrypt library support
libmcrypt.i686 : Encryption algorithms library
libmcrypt.x86_64 : Encryption algorithms library
libtomcrypt.i686 : A comprehensive, portable cryptographic toolkit
libtomcrypt.x86_64 : A comprehensive, portable cryptographic toolkit
mcrypt.x86_64 : Replacement for crypt()
```
Finally:
sudo service httpd restart
I was having same issue in centos 6.5
Finaly solution below worked for me
-go to http://dl.fedoraproject.org/pub/epel/6/x86_64/
-search for php-mcrypt(http://dl.fedoraproject.org/pub/epel/6/x86_64/php-mcrypt-5.3.3-3.el6.x86_64.rpm)
-execute wget http://dl.fedoraproject.org/pub/epel/6/x86_64/php-mcrypt-5.3.3-3.el6.x86_64.rpm
-rpm -ivh php-mcrypt-5.3.3-3.el6.x86_64.rpm
if there are any dependencies you can download same using http://dl.fedoraproject.org/pub/epel/6/x86_64/
For php 7 to install mcrypt run:
Centos:
sudo yum install php7.0-mcrypt to install
On Ubuntu:
sudo apt-get install php7.0-mcrypt
If you want to recompile PHP with mcrypt enable.
1.
Insatll mcrypt. libmcrypt-devel is from Third Party Repositories EPEL, so you should:
yum --enablerepo=extras install epel-release
yum install libmcrypt-devel
2.
Append --with-mcrypt to your ./configure arguments:
./configure --with-mcrypt
3.
Build and install:
make & make install
Try
yum clean all
yum remove epel-release
yum install epel-release
and finally
yum install php-mcrypt

Categories