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

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.

Related

Upgrade to PHP 7 - no package php70w available

I try to update my godaddy VPS with cpanel and Centos 6 to use PHP7.
As easyApache isn't supporting PHP7 yet, I have to do it through SSH.
So i did the following:
yum update
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
yum install php70w
But after the last step I am getting the error message:
No package php70w available.
What am I doing wrong, no matter what tutorial I look at - I always fail at this step: yum install php70w

Upgrading PHP on CentOS 6.5 (Final)

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

Hostgator Vps 1 install yum packages

I am trying to install packages using repositories.
I have tried Webtatic and install using
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
I then try
yum install --enablerepo=webtatic package-name
yum install cpanel-php53.x86_64
but I always get setting up install process nothing to do
How would I get php to work on this server? And also yum list install returns along list of packages do I have to do anything extra with these packages to use them
For custom rpm build, follow this guide.
http://docs.cpanel.net/twiki/bin/view/AllDocumentation/WHMDocs/CustomBuildRpm

struggling to install PHP pecl on Centos

I'm trying to install the php_http PHP extension on my CentOS server.
I have done:
yum install php-pear
But get:
No package php-pear available
Yet I can do:
pear
And get a list of commands from Pear.
Same for yum install pecl. I can do pecl but pecl install pecl_http returns:
No releases available for package "pecl.php.net/pecl_http"
install failed
Yet /usr/bin/pecl isn't a directory that exists. Also a sudo pecl install pecl_http returns sudo: pecl: command not found, which I find quite odd.
I'm not entirely sure what's going on here/what I'm doing wrong.
edit: I am using the following repos:
base CentOS-6 - Base
epel Extra Packages for Enterprise Linux 6 - x86_64
extras CentOS-6 - Extras
rpmforge RHEL 6 - RPMforge.net - dag
updates CentOS-6 - Updates
vz-base vz-base
vz-updates vz-updates
On CentOS,
Install PHP Pear if not installed yet:
# yum install php-pear
Install GCC if not installed yet:
# yum install gcc
Install cURL if not installed yet:
# yum install curl-devel
Install following libraries if not installed yet:
# yum install php-devel
# yum install zlib-devel
# yum install pcre-devel
Start the main installation:
# pecl install pecl_http
Add the following line to /etc/php.ini file
extension=raphf.so
extension=propro.so
extension=http.so
Restart apache server so the extension can be loaded
# service httpd restart
You can check if it installed successfully or not:
# pecl list
Step 1) import the REMI repo
CentOS 5
rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm;
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm;
CentOS 6
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm;
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm;
Step 2) install php-pear
yum --enablerepo=remi,remi-php55 install php-pear
Step 3) install pecl_http
pecl install pecl_http
For other people having this problem. I discovered this question while trying to figure out why I was having the same problem. Turned out the default configuration at my hosting provider was to include php* in the exclude directive for yum. Check /etc/yum.conf and make sure that the package you're trying to install isn't matched by an entry in the exclude directive.
if you are running php 7 you might want to try this
yum install php70w-pear
if you get any errors, be sure to uninstall the pear package from any previous attempts
yum remove php-pear
best of luck
If you are using php 5.4.x, IMO best repo to use is iuscommunity. Its very stable and used by Rackspace to do only PHP and a few other packages for CentOS.
rpm -Uhv http://dl.iuscommunity.org/pub/ius/stable/CentOS/6/x86_64/ius-release-1.0-11.ius.centos6.noarch.rpm
yum install php54-pear
Mind you, the reason why its php54-pear and not php-pear is because 5.3 and 5.4 both are compiled in the repository. Here is the list of php packages -> http://dl.iuscommunity.org/pub/ius/stable/CentOS/6/x86_64/repoview/development.languages.group.html
I tested this and it works, but I only use EPEL and iuscommunity REPO's. I avoid using rpmforge myself.
Centos 6.5 and php7:
sudo su -
yum install yum-utils
you can get last version of lua : http://pecl.php.net/package/lua
wget http://pecl.php.net/get/lua-2.0.4.tgz
tar -xvzf lua-2.0.4.tgz
cd lua-2.0.4
mkdir /usr/include/lua
mv * /usr/include/lua
yum install gcc
yum install php70w-pearl php70w-devel
yum install curl-devel
yum install zlib-devel
yum install pcre-devel
ln -s /usr/include/lua.h /usr/include/lua/lua.h
rpm -Uvh https://centos6.iuscommunity.org/ius-release.rpm
yum-config-manager --enable remi-php70
yum update
yum --enablerepo=remi,remi-php70 install php70w-pear
yum install lua-devel lua-static
pecl install lua-2.0.4
Whatever your PHP provider is (IUS, Remi or Webtatic), the pear package and the pecl extensions "should" be available there, without any need to compile it from sources (which is usually discouraged, especially on production)
At least "remi" provides most extensions, see the list
So installation should be as simple as
yum install php-pecl-http
yum install php-pecl-lua
etc
And, don't forget to read the Wizard instructions
I tried almost everything on this list before I finally realized that my WHM/cPanel installation was blocking the yum packages. I have to install all PECL modules (I was stuck trying to install mongodb on this particular occation) through the Home > Software > Module Installers inside WHM (cpanel documentation says that you have to be logged in as root).
After watching a lot of threads and installing pear and all the devtool, I finally solved it installing this extension:
yum install php-pecl-mongo
as I seen in - https://madcoda.com/2012/12/install-mongodb-php-driver-in-centos-6-3/

can't install php-devel on centos

I need help with installation of php-devel (I need it, cause it has phpize, which is necessary to install eAccelerator). But when I try to install php-devel with yum install php-devel it gives me the following errors:
# yum install php-devel
Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile
* base: centos.itt-consulting.com
* epel: mirror.yandex.ru
* extras: centos.itt-consulting.com
* passenger: mirror.hmdc.harvard.edu
* updates: centos.itt-consulting.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package php-devel.x86_64 0:5.3.3-14.el6_3 will be installed
--> Processing Dependency: php = 5.3.3-14.el6_3 for package: php-devel-5.3.3-14.el6_3.x86_64
--> Finished Dependency Resolution
Error: Package: php-devel-5.3.3-14.el6_3.x86_64 (updates)
Requires: php = 5.3.3-14.el6_3
Installed: php-5.4.6-1.el6.remi.x86_64 (#remi-test)
php = 5.4.6-1.el6.remi
Available: php-5.3.3-3.el6_2.8.x86_64 (base)
php = 5.3.3-3.el6_2.8
Available: php-5.3.3-14.el6_3.x86_64 (updates)
php = 5.3.3-14.el6_3
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
I have no idea what to do with these errors. And I have php 5.3.3 installed (phpinfo() says that), so don't understand why in this list I can see Installed: php-5.4...
Rather than running yum install php-devel you needed to run yum --enablerepo=remi,remi-php54 install php-devel .
In short, just specifying which php-devel version you wanted from the remi repo. In your case you had php54 installed from remi so you needed to add in "remi-php54" . That would have successfully installed php-devel without the downtime.
What I did was:
yum search php53
and it showed the php-devel file to install. Once I did the search and found the correct devel package, I simply copied and pasted the entire name after yum install. I executed
yum install php53-devel.x86_64
to get it
If you have php 5.5.x, centos 6.5 64 try this
yum install php55w-devel
You will need also gcc
yum install gcc.x86_64
php was installed from Remi's repository. You will need to either downgrade to the stock php, or get php-devel from the same place.
sudo yum --enablerepo=remi install php-devel
Taking into consideration that I have different things installed from different repos, the only way was to delete all packages installed from Remi's repo and install standard packages with yum.
1) List all packages installed from some strange repo (in my case #remi), e.g. yum list installed | grep remi.
2) Remove all packages completely from the system with yum remove <package_name>
NOTE: after httpd restarting - all sites will DIE!
3) Quickly install all bunch of things you need, e.g. yum install php-mysql php-gd php-imap php-ldap php-mbstring php-odbc php-pear php-xml php-xmlrpc etc.
4) Restart httpd and start mysql server.
5) Your sites are alive again.
The only thing why I did all this is cause I wanted to install eAccelerator for php to speed it up a little bit (and it's installation was impossible because of remi's repo packages), and I'm happy that I did it! All scripts works 2-10 times faster (I could not even imagine that my sites can respond so fast).
About the initial question (install eAccelerator).
This project is dead, and have never work with PHP >= 5.4.
So if you need an opcode cache, please choose a maintained one. I would recommend "opcache", the official cache maintained by the PHP project, included in php-src since 5.5, and available in pecl for 5.4.
And if you use "remi" repository, before trying to build an extension, check first if it is available in the repository, as most of the PECL extensions are available as RPM, see http://blog.remirepo.net/pages/PECL-extensions-RPM-status
yum --enablerepo=remi,remi-php55 install php55-devel
worked for me
For PHP 7.2 and similar, the following works for me(notice the remi-php72)
sudo yum --enablerepo=remi,remi-php72 install php-devel
if this is about installing xdebug requirements for centos then:
sudo yum --enablerepo=remi,remi-php72 install php-devel autoconf automake
Just type:
sudo nano /etc/yum.conf
And then remove php*
then type:
yum install --enablerepo remi php-pear php-devel

Categories