justuptime.com - monitor your servers & websites

How to upgrade php?

You are viewing this site as a guest. Join our community to get your questions answered and share knowledge. Active members may advertise and ask for a website critique.

They have: 317 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
Moderator

He has: 3,710 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: 317 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
ModeratorSponsor

He has: 823 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: 152 posts

Joined: Sep 2006

How does PHP5 differ from PHP4?

decibel.places's picture

They have: 668 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: 335 posts

Joined: May 2007

decibel.places's picture

They have: 668 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: 335 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
--
"Old web developers don't die, they degrade gracefully..."