0

I have a PHP program using MySQL that I will be making open-source, including a simple installer, and I want to make it as easy to install on any server with PHP4 or 5 and MySQL 4 as possible.

I've included an installer to make it user-friendly, but I need to know what are the things I can do to make it most likely to install on every server.

I'll start: I've made sure to use full PHP tags (not short) like this <?php ?> and to make sure all variables are declared prior to using them, like so $nVar = (isset($_POST['nVar']) ? $_POST['nVar'] : NULL);.

What other best practices should be incorporated in a PHP app for the best cross-server compatability?

Michael
  • 388
  • 6
  • 20
  • 5
    PHP4 and MySQL4 are both long dead. Trying to support them vastly limits what your application will be capable of. It's a lot like trying to support IE6. Just don't bother. You will live longer... – DaveRandom Jul 12 '12 at 22:45

1 Answers1

0

Just a few hints, from the top of my head

The class { __constructor } is deprecated.
Dont use GLOBAL
Use split and join
Watch out for file magic byte recognition functions
The get_class get_parent_class alphanumerical changed to accept camelcasing - use strtolower on returned value before comparing

Ben Swinburne
  • 25,669
  • 10
  • 69
  • 108
  • Are you **SURE** that `__construct()` is deprecated? It is one of the most useful and important functions in PHP. – Nadav S. Jul 12 '12 at 22:56
  • `__construct()` is not deprecated - however it doesn't (like nearly all the OO functionality) exist in PHP4. I concur with comments that PHP4 is not worth supporting - try even finding a manual for it now! – John C Jul 12 '12 at 23:32
  • Can you expand on the "don't use GLOBAL" point? Do you mean in classes or in regular functions? – Michael Jul 13 '12 at 14:15