Upgrading PHP4 to PHP5 on CentOS the smooth way

Installing, Configuring, Troubleshooting server daemons such as Web and Mail
mgnetuk
Posts: 1
Joined: 2007/01/14 13:56:43
Location: United Kingdom

Upgrading PHP4 to PHP5 on CentOS the smooth way

Post by mgnetuk » 2007/02/08 16:27:34

CentOS 4.4 does not come with PHP5 as standard. I wanted to upgrade my server to PHP5, but found that MySQL is now disabled in PHP5! This is somewhat annoying to say the least. I am not the only one with this gripe, Googling around the Linux/web dev online world came up with some interesting posts.

PHP4 was upgraded to PHP5 from the CentOS plus repository. To use this repo, edit:

/etc/yum.repos.d/Centos-base.repo

and in the CentOS plus section change

enabled=0

to

enabled=1

Then run:

yum update php*


Now, to enable mysql support simply change the following files:

/etc/my.cnf.rpmnew

to

/etc/my.cnf

and

/etc/php.ini.rpmnew

to

/etc/php.ini

using vi, mc, nano or whatever you prefer.

Now restart Apache by typing:

# service httpd restart

You should now have PHP5 WITH mysql support on CentOS 4. :-)

To prove you have PHP5 type

# php -v

Should output something like this:

# php -v
PHP 5.1.6 (cli) (built: Nov 17 2006 08:52:42)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies

Enjoy the power of PHP5!

Apologies if this is already posted elsewhere. I hope this helps.

See the original article here:

[url=http://www.mgnetuk.com/wordpress]www.mgnetuk.com/wordpress[/url]

Regards,

Mike

teleport
Posts: 114
Joined: 2005/09/09 05:30:18
Contact:

Upgrading PHP4 to PHP5 on CentOS the smooth way

Post by teleport » 2007/02/08 20:02:19

You do not need to modify repo files. "yum --enablerepo=centosplus update php*" will do same thing.

rawoo
Posts: 5
Joined: 2006/05/03 19:52:00

Re: Upgrading PHP4 to PHP5 on CentOS the smooth way

Post by rawoo » 2007/02/09 23:01:05

Ah, but what about getting PHP4 and PHP5 existing peacefully side by side on CentOS 4? Anyone have a simple and effective receipe for this?

pjwelsh
Posts: 2598
Joined: 2007/01/07 02:18:02
Location: Central IL USA

Re: Upgrading PHP4 to PHP5 on CentOS the smooth way

Post by pjwelsh » 2007/02/12 04:08:38

Adding it to the repos.d/files will get any future updates/bug fixes with yum enabled...

dakine
Posts: 3
Joined: 2007/03/14 21:50:27
Contact:

Re: Upgrading PHP4 to PHP5 on CentOS the smooth way

Post by dakine » 2007/03/14 22:24:04

[root@mark yum.repos.d]# yum update php*
-bash: yum: command not found

Theres directories for yum, why isnt it working?

NOTE: Im a newbie!!

dakine
Posts: 3
Joined: 2007/03/14 21:50:27
Contact:

Re: Upgrading PHP4 to PHP5 on CentOS the smooth way

Post by dakine » 2007/03/18 06:50:27

I done everything you said and I get this error

--> Finished Dependency Resolution
Error: Missing Dependency: php = 4.3.9-3.22.3 is needed by package php-domxml

How do I fix this??

Thanks in advanced
Mark

jult
Posts: 40
Joined: 2007/01/04 02:10:11
Location: Amsterdam, .NL
Contact:

Re: Upgrading PHP4 to PHP5 on CentOS the smooth way

Post by jult » 2007/03/19 13:14:55

Same here. I've been running my CentOS 4.4 for months on php 5.* now, all was smooth until recently in yum I can't get past the dependencies.

Personally, I don't see reasons to still use php 4.* for anything, but that's just me. I'm not using scripts that still need 4.*

Sure, I know you're being risky when using centosplus or other repositories, but I think the base centos repository can use some major updates by now!

breun
Posts: 47
Joined: 2006/11/09 18:01:17
Location: The Netherlands
Contact:

Re: Upgrading PHP4 to PHP5 on CentOS the smooth way

Post by breun » 2007/04/01 22:31:16

The [url=http://mirror.centos.org/centos-4/4.4/centosplus/Readme.txt]CentOS Plus repo readme[/url] is pretty clear on this:

[quote]-------------------------
php-5.x.x-x.centos4
-------------------------
This is php-5 for CentOS-4. It replaces the php-4.3.9 that is currently
in CentOS-4. In order to upgrade a current php-4 install, you must
remove php-domxml first and then do:

yum --enablerepo=centosplus upgrade php*

or to do and install, use this command:

yum --enablerepo=centosplus --exclude=php-domxml install php*

(or install individually the files that you need)[/quote]

breun
Posts: 47
Joined: 2006/11/09 18:01:17
Location: The Netherlands
Contact:

Re: Upgrading PHP4 to PHP5 on CentOS the smooth way

Post by breun » 2007/04/01 22:38:17

[quote]Sure, I know you're being risky when using centosplus or other repositories, but I think the base centos repository can use some major updates by now![/quote]

I think you don't quite get the idea of CentOS. The CentOS base repositories are 100% binary compatible with RHEL. Since RHEL doesn't do version upgrades during a release cycle, CentOS doesn't those either. If you want to upgrade some package to a new major version (PHP4 -> PHP5 for instance), you can choose to do so by using extra repositories like CentOS Plus, but don't expect major version upgrades through the updates channel.

CentOS 5 should be out soon though... :)

mrpbjnance
Posts: 4
Joined: 2007/07/13 04:38:08

Re: Upgrading PHP4 to PHP5 on CentOS the smooth way

Post by mrpbjnance » 2007/07/13 04:59:54

-------------------------
php-5.x.x-x.centos4
-------------------------
This is php-5 for CentOS-4. It replaces the php-4.3.9 that is currently
in CentOS-4. In order to upgrade a current php-4 install, you must
remove php-domxml first and then do:

yum --enablerepo=centosplus upgrade php*

or to do and install, use this command:

yum --enablerepo=centosplus --exclude=php-domxml install php*

(or install individually the files that you need)



Sorry newbiew question

Can someone tell me where php-domxml would be.

We want to upgrade from php 4.3.9 to php5 I am from old unix days and VERY confused.
If anyone would be will to show me steps I would be greatful

Post Reply

Return to “CentOS 4 - Server Support”