How to update CentOS 5.9 with PHP 5.2 to current PHP?
At any rate, I've got a Linode running CentOS 5.9 and PHP 5.2.10, and I want to update to a newer/latest version. It doesn't seem that the YUM repository offers this. Do the 'experts' have suggestions, or can someone point me to an updated guide? Thank you in advance.
8 Replies
CentOS v6.4 runs PHP v5.3.3 and you can get PHP v5.4 if you add the REMI repo.
Whatever you do - don't add the webtatic repo -that repo is NOTHING but trouble.
Why are you running CentOS v5.x instead of the current v6.x?
I am running CentOS 5 because that's what I began the server with back in 2010, and because I don't know how to upgrade without breaking something.
Feel free to make suggestions, link a guide, or offer your services.
Why do you think you need a newer version of PHP?
@Vance:
PHP 5.3.3 is included in the base repository for CentOS 5. You will need to remove the php* packages and install the corresponding php53* packages. I had to do this for a newer MediaWiki version that didn't support PHP 5.1, and it went smoothly, but I could afford the hour or so of downtime involved. Whether you want to do this on your running system is your choice.
You've got my attention! Since I've never had to remove PHP (or any package, really) and have no idea how to do it, can you point me to a guide or tutorial? Anything you can provide would be helpful.
First, run yum list installed 'php'* to see what packages you're currently using. You'll get something like this:
php.i386 5.1.6-39.el5_8 installed
php-cli.i386 5.1.6-39.el5_8 installed
php-common.i386 5.1.6-39.el5_8 installed
php-gd.i386 5.1.6-39.el5_8 installed
php-mysql.i386 5.1.6-39.el5_8 installed
php-pdo.i386 5.1.6-39.el5_8 installed
php-xml.i386 5.1.6-39.el5_8 installed
Then find out what PHP 5.3 packages and modules are available with yum list available 'php53'*:
php53.i386 5.3.3-13.el5_9.1 updates
php53-bcmath.i386 5.3.3-13.el5_9.1 updates
php53-cli.i386 5.3.3-13.el5_9.1 updates
php53-common.i386 5.3.3-13.el5_9.1 updates
php53-dba.i386 5.3.3-13.el5_9.1 updates
php53-devel.i386 5.3.3-13.el5_9.1 updates
php53-gd.i386 5.3.3-13.el5_9.1 updates
php53-imap.i386 5.3.3-13.el5_9.1 updates
php53-intl.i386 5.3.3-13.el5_9.1 updates
php53-ldap.i386 5.3.3-13.el5_9.1 updates
php53-mbstring.i386 5.3.3-13.el5_9.1 updates
php53-mysql.i386 5.3.3-13.el5_9.1 updates
php53-odbc64.i386 5.3.3-2.el5 base
php53-odbc.i386 5.3.3-13.el5_9.1 updates
php53-pdo.i386 5.3.3-13.el5_9.1 updates
php53-pgsql.i386 5.3.3-13.el5_9.1 updates
php53-process.i386 5.3.3-13.el5_9.1 updates
php53-pspell.i386 5.3.3-13.el5_9.1 updates
php53-snmp.i386 5.3.3-13.el5_9.1 updates
php53-soap.i386 5.3.3-13.el5_9.1 updates
php53-xml.i386 5.3.3-13.el5_9.1 updates
php53-xmlrpc.i386 5.3.3-13.el5_9.1 updates
If there is a corresponding php53 package for each php one you have installed, you're good. Otherwise, you may have to use other repositories to get the missing packages, or you may not actually need those modules at all. We'll assume that everything you need is there, as in this example. You will want to stop your web server using service httpd stop (for Apache).
Now you will remove the packages with yum remove php php-cli php-common php-gd php-mysql php-pdo php-xml, using the names of the packages from the first step. Yum may want to remove other packages that depend on these. Make sure you note all the names of these packages.
Then you can install the 5.3 packages using yum install php53 php53-cli php53-common php53-gd php53-mysql php53-pdo php53-xml. Also include the names of any other packages that were removed in the previous step. If yum complains that some dependencies can't be resolved, then one or more of those additional packages are marked as requiring PHP 5.1. You can revert back to your original setup by running something like yum install php php-cli php-common php-gd php-mysql php-pdo php-xml, including the names of any additional packages removed in the prior step.
If the php53 install succeeded, then you can restart the web server with service httpd start, although it might be a good idea to just reboot the entire server to make sure everything's working. Then you can try visiting your web applications to make sure they behave as expected. That's about it.
Installed Packages
php.i386 5.2.10-1.el5.centos installed
php-cli.i386 5.2.10-1.el5.centos installed
php-common.i386 5.2.10-1.el5.centos installed
php-devel.i386 5.2.10-1.el5.centos installed
php-gd.i386 5.2.10-1.el5.centos installed
php-mbstring.i386 5.2.10-1.el5.centos installed
php-mcrypt.i386 5.2.9-2.el5.centos.3 installed
php-mysql.i386 5.2.10-1.el5.centos installed
php-pdo.i386 5.2.10-1.el5.centos installed
php-snmp.i386 5.2.10-1.el5.centos installed
I will admit that it's unclear why some of the packages are installed, so when I install the new ones I'll do so step by step. Here are the available packages:
Available Packages
php53.i386 5.3.3-13.el5_9.1 updates
php53-bcmath.i386 5.3.3-13.el5_9.1 updates
php53-cli.i386 5.3.3-13.el5_9.1 updates
php53-common.i386 5.3.3-13.el5_9.1 updates
php53-dba.i386 5.3.3-13.el5_9.1 updates
php53-devel.i386 5.3.3-13.el5_9.1 updates
php53-enchant.i386 5.3.3-1.el5 epel
php53-gd.i386 5.3.3-13.el5_9.1 updates
php53-imap.i386 5.3.3-13.el5_9.1 updates
php53-interbase.i386 5.3.3-1.el5 epel
php53-intl.i386 5.3.3-13.el5_9.1 updates
php53-ldap.i386 5.3.3-13.el5_9.1 updates
php53-mapi.i386 7.0.13-1.el5 epel
php53-mbstring.i386 5.3.3-13.el5_9.1 updates
php53-mcrypt.i386 5.3.3-1.el5 epel
php53-mssql.i386 5.3.3-1.el5 epel
php53-mysql.i386 5.3.3-13.el5_9.1 updates
php53-odbc.i386 5.3.3-13.el5_9.1 updates
php53-odbc64.i386 5.3.3-2.el5 base
php53-pdo.i386 5.3.3-13.el5_9.1 updates
php53-pgsql.i386 5.3.3-13.el5_9.1 updates
php53-php-gettext.noarch 1.0.11-3.el5 epel
php53-process.i386 5.3.3-13.el5_9.1 updates
php53-pspell.i386 5.3.3-13.el5_9.1 updates
php53-recode.i386 5.3.3-1.el5 epel
php53-simplepie.noarch 1.3.1-5.el5 epel
php53-snmp.i386 5.3.3-13.el5_9.1 updates
php53-soap.i386 5.3.3-13.el5_9.1 updates
php53-tidy.i386 5.3.3-1.el5 epel
php53-xml.i386 5.3.3-13.el5_9.1 updates
php53-xmlrpc.i386 5.3.3-13.el5_9.1 updates
yum install php53 php53-cli php53-common php53-devel php53-gd php53-mbstring php53-mcrypt php53-mysql php53-pdo php53-snmp
and everything installed without issue. Very simple process! Here's proof that it's all installed:
Installed Packages
php53.i386 5.3.3-13.el5_9.1 installed
php53-cli.i386 5.3.3-13.el5_9.1 installed
php53-common.i386 5.3.3-13.el5_9.1 installed
php53-devel.i386 5.3.3-13.el5_9.1 installed
php53-gd.i386 5.3.3-13.el5_9.1 installed
php53-mbstring.i386 5.3.3-13.el5_9.1 installed
php53-mcrypt.i386 5.3.3-1.el5 installed
php53-mysql.i386 5.3.3-13.el5_9.1 installed
php53-pdo.i386 5.3.3-13.el5_9.1 installed
php53-snmp.i386 5.3.3-13.el5_9.1 installed
However, after restarting Apache, the WordPress website was unavailable but the Joomla website could still log into the admin console. The WordPress URL gave me a generic 500 error, but the Joomla URL displayed a theme without content. This lead me to believe there was an issue with MySQL somewhere, but then I could find/see/edit all of the content items in the admin console. I eventually resolved this to xCache, and discovered that it needed to be re-installed after the PHP update.
THANK YOU for your guidance!