0

I am currently running CentOS v 4.8 and it has PHP version 4.3.9 installed on it. I want to update to the latest PHP version, 5.2 or above, however, I'm not sure how to go about doing this.

I read that doing a yum update php might cause issues with the existing php installation?

I read somewhere that there are external repositories that help doing this as well. Are there any reocmmendations?

The server is live, so I don't want to ruin it by an update. Any precautions to keep in mind? I intend to backup the mySQL database and all the files as well. Anything else I should keep in mind?

I read a post on this site by coops, recommending atomic repos, is this recommended in my situation?

wget -q -O - http://www.atomicorp.com/installers/atomic.sh | sh
yum update php
service httpd restart

Is these the right steps to install the Remi repo? I'm using Enterprise Linux (RHEL, CentOS) :

su -
cd /etc/yum.repos.d
wget http://rpms.famillecollet.com/enterprise/remi.repo
yum --enablerepo=remi update php-\*

Output after running yum list php

Error: Bad repository file ///etc/yum.repos.d/CentOS-Testing.repo, no repo stanzas.
Setting up repositories
Reading repository metadata in from local files
Installed Packages
php.i386                                 5.2.14-2.el4.art       installed

I had to install the atomic repo. Since I was getting the following error with REMI:

warning: rpmts_HdrFromFdno: V3 DSA signature: NOKEY, key ID 00f97f56
Public key for php-pgsql-5.3.3-1.el4.remi.i386.rpm is not installed
Retrieving GPG key from http://rpms.famillecollet.com/RPM-GPG-KEY-remi


GPG key retrieval failed: [Errno 4] IOError: <urlopen error (101, 'Network is unreachable')>
3
  • The precaution is don't do this on a live server, period. Nov 12, 2010 at 20:12
  • Well, is there a safer alternative? What could go wrong at the most? Additionally, I've read that I can rollback the version in the event that there is an issue ..
    – confused
    Nov 12, 2010 at 20:19
  • 1
    The safer alternative is to do it on one of your testing machines first, and then test until you feel confident. Nov 12, 2010 at 20:24

4 Answers 4

2

RHEL4 (what CentOS 4 is derived from) has reached the end production phase and will be end of life in January 2014. More information can be found on the Red Hat Enterprise Linux Life Cycle page. I suggest you put your effort into upgrading to CentOS 6 rather than spending time and energy on a distribution which soon become unsupported.

Barring that what Eddie suggested is going to be your next best choice, installing php from source. However there may be additional dependency issues making the whole process a potential mess.

I recommend you upgrade to RHEL6 or CentOS6. Yes this upgrade will take time, but it may end up taking less time than getting php 5 to run without issue on CentOS 4.

0

My suggestion is download php sources and compile them.
Do any kind of upgrade (by repo, by sources) on a production server without experiences it's a suicide. In addition, PHP 4.x and 5.x are quite two different worlds so the most of your problems not on the system side but in the application runtime (I mean that, for example, the server is ok, configured and upgrade but all the php application are broken and not working).

Please save yourself from hell, let you help in this process by someone expert.

-1

Ok look, yea we get it ... don't do this on a live server but eventually the OP has to do this. So here's an answer for you. Backup the important stuff (i.e. config files, data, etc...). Find a yum repository and run the upgrade for PHP. I would then disable the repo once you take care of PHP, assuming you don't want to upgrade any other packages.

I like Remi's REPO

8
  • Thanks for the reply. Can you please have a look at my edit? I didn't wnat to post code in the comment ...
    – confused
    Nov 12, 2010 at 21:24
  • looks fine to me.
    – sdot257
    Nov 12, 2010 at 21:28
  • Another thing, if I did a yum update php. The latest php version it would go to is 4.3.9 right?
    – confused
    Nov 12, 2010 at 22:18
  • I was able to finally do the upgrade without any errors. But when I do a 'php -v', it shows my older version itself. I did an apache restart and still it gives me the older version, here's the message: Starting httpd: [Fri Nov 12 18:11:46 2010] [warn] module php5_module is already loaded, skipping
    – confused
    Nov 12, 2010 at 22:46
  • run yum list php and tell me what you see. You may need to update the "php-cli" package. Did you manually enter the php5_model into httpd.conf? I believe the installation may have done so for you. Regardless, it's a warning and can be ignored for now. What does phpinfo() show?
    – sdot257
    Nov 13, 2010 at 12:35
-1
yum --enablerepo=centosplus install php

wont that give you a php 5.something??

you could also consider installing Zend's PHP.. Which is well maintained. :D http://files.zend.com/help/Zend-Server/rpm_installation.htm

For what it is worth.. Compiling your own PHP is extremely easy and fast..

Forget about confusing repo's and mismatched packages.. This could be very easy or break your system..

Leave the package management to the experts who manage the OS...

6
  • And compiling is made for someone who has no OS experience? Come on, yum is so freaking easy, compiling is a hassle if you ask me. I avoid it if I can but there are times when I want the latest and the greatest and I cant find a repo. PHP is NOT one of them, there are plenty of REPO out there to use.
    – sdot257
    Nov 15, 2010 at 3:51
  • This is not windows ??? Php repo's offered for Centos are generally terrible, take into account everything outside centosplus/epel/zend. Sorry.. but using "another" repo is just bad news IMHO.. You vote me down for offering a valid solution??? your not much of a sportmans :P
    – Arenstar
    Nov 15, 2010 at 6:46
  • Did we solve your problems????
    – Arenstar
    Nov 17, 2010 at 15:46
  • Grab a repo from a respected person/org not someone you don't know. So i take it you wouldn't use Dag's repo either right?
    – sdot257
    Nov 17, 2010 at 17:02
  • When working with high performance systems, unless its a standalone binary.. No - you should not use a "guys" repo.. If he makes a mistake, then your "yum update" breaks everything... If you wanna run a webserver at home or develop, then fine.. its absolutely ok.. I was previously running a system at 99.999% uptime a year, Remi's php acted a little out than the zend or the centos binaries.. It broke the whole application.. My point is, be careful what you install..
    – Arenstar
    Nov 17, 2010 at 18:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .