How to upgrade php?

They have: 426 posts

Joined: Feb 2005

My VPS has php 4.3.0 installed. I need to at least upgrade to latest php4.

can this be done easily. For sure i have backed everything up but i dont want the server to be down for a long period of time.

i am running ubuntu with apache 2

any help appreciated.

JeevesBond's picture

He has: 3,956 posts

Joined: Jun 2002

What happens if you try running:

sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade

That should update it. Checking my Ubuntu install, PHP5 is in a seperate package to version four, so if you want to install it run:

sudo apt-get install php5

a Padded Cell our articles site!

They have: 426 posts

Joined: Feb 2005

So if i install php 5 as above it wont change anything with my current setup with php4 - meaning my websites will be ok and all configuration?

To use php 5 i should just change apache config to point to php 5 rather than php4?

pr0gr4mm3r's picture

He has: 1,502 posts

Joined: Sep 2006

If you run the update commands, your config files won't change. You will risk broken sites if you upgrade to PHP 5. That's why many hosts are lazy to do it.

I would back up all the config files and then upgrade to PHP5. You may have some downtime reconfiguring some things, but PHP4 is no longer supported and if your version is out of date, you are running a security risk which could result in unplanned downtime.

ohrana's picture

They have: 156 posts

Joined: Sep 2006

How does PHP5 differ from PHP4?

decibel.places's picture

He has: 1,494 posts

Joined: Jun 2008

Well, I had a nasty surprise with an email validation script I wrote and tested on PHP5 but client's server was running PHP4

PHP4 does not support the strpbrk() function, eg $invalidChar = strpbrk($fromEmail, '!#$%^&*()_+=-{}|\]["\':;?/><,'); - I had to replace this one line with a whole list of $invalidChar .= strpos($fromEmail, "!"); statements

Another place I just did the validation with JavaScript...

When I asked, the server admin said "PHP5 is not stable" I think that is BS, I have had no problems with PHP5

However I have another client whose WebScribble WebDate platform just stopped working suddenly. Been around the bush several times with fresh installs etc. I see they are running PHP 5.25 but they won't give me a straight answer about when it began. My hunch is that is the cause, or maybe a MySQL misconfiguration. The script connects with the db on install to create all the tables, but in use it does not connect....

He has: 629 posts

Joined: May 2007

decibel.places's picture

He has: 1,494 posts

Joined: Jun 2008

The problem was actually migrating a PHP5 script to PHP4 Wink
- no strpbrk() in PHP4 -

As for the web hosting problem, I have had Paul, who runs an independent Webscribble WebDate forum, look it over and he's scratching his head. Next stop is changing the DNS (app is licensed to a specific domain) and trying out on my server for proof it works.

He has: 629 posts

Joined: May 2007

Hmm. Migrating to PHP4?

This is from Migrating legacy PHP 4 applications to PHP 5 -

Quote:
PHP 4 has been discontinued for some time... Major legacy applications should be ported as quickly as possible to avoid security issues;

Cordially, David
--
delete from internet where user_agent="MSIE" and version < 8;

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.