PHP 4 vs PHP 5

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Over the past year or so I have been teaching myself php and have
exclusively used php 5. I now need to create a script to handle form
information on a server running php 4 (we will upgrade to 5, but it
may be a while).

I will be creating and testing the script on a local server with php
5.2, then uploading for final testing and deployment on a server with

Now this may be vaque, but what I need to know, for a script that is
just going to take a html form post information and up to 6 word files
uploaded, and then email them as an attachment with the data, is there
any major change between 4 and 5?

If the changes between 4 & 5 are large, I will just write it in perl,
but would prefer php (at least the 5 version) due to the ease of file

Bill H

Re: PHP 4 vs PHP 5

Hi Bill,

If there is absolutely no chance to have PHP 5 running on your
production server, I'd suggest to run PHP 4 on your testing server...
Without a doubt, you will run into trouble. No science here, just
common sense...

PHP 5 has more possibilities to work with classes (private/public
functions, etc...). It also has specific functions or libraries that
are only available to PHP5, ie. SimpleXML. The function references on will usually tell you in which version those functions are

But again, why make it hard on yourself and test your software on a
server with a (deliberately) different configuration then your
production environment.

Kind regards,

Re: PHP 4 vs PHP 5

Mathieu Maes wrote:
Quoted text here. Click to load it

A quick google of "php4 php5 differences" led to:

Re: PHP 4 vs PHP 5

Bill H wrote:
Quoted text here. Click to load it

Why don't you run this over to the production server from time to time
and test it?

   If you have an error that you can't see on your production server you
can add a script like this:


error_reporting (E_ALL);

include_once 'script_to_test';


Quoted text here. Click to load it

It's not hard in perl. It's maybe one more line.

I've had more than one instance where I took the utilities I wrote and
loaded them up on a server that was running php4. php5 has been out
there for some time, tell them to get with it. So far I haven't seen any
  php4 scripts that didn't run in php5, the reverse was not true. That
doesn't mean it can't happen it's just unlikely in well crafted scripts.
  I used to have a short check list of what to look out for.

   Now, most of the problems I had were due to the way classes are done
in php5 and the widespread lack of some modules like PDO in php4, you
may not have any issues.


Quoted text here. Click to load it

Re: PHP 4 vs PHP 5

On Wed, 7 Jan 2009 04:15:23 -0800 (PST), wrote:

Quoted text here. Click to load it

As previously suggested by Mathieu Maes, you should make your
development environment match your production environment.

Quoted text here. Click to load it

Short answer:  it depends.

The PHP documentation has a PHP 4 to 5 migration page that should
help you spot certain issues in PHP 4.

RTM: <

$email = str_replace('sig.invalid', '', $from);

Re: PHP 4 vs PHP 5

Quoted text here. Click to load it


The server is mine. The reason why I can't upgrade it is I have been
unable to find the rpm package for php5. It is a Sun RAQ4 running
apache. Any ideas where I would find them?

Bill H

Re: PHP 4 vs PHP 5

On Fri, 9 Jan 2009 01:49:09 -0800 (PST), wrote:
Quoted text here. Click to load it
Quoted text here. Click to load it

Your production and development environments should still be the=20
same; it makes things easier.

Quoted text here. Click to load it

Not really, but PHP has a list of sites[1] you can check out for *nix=20
binaries, but you may not be able to get the latest versions.  You=20
may have to compile from source?  Have you tried that?

[1] <

$email = str_replace('sig.invalid', '', $from);

Site Timeline