PHP 4? OMG! A small vademecum for obsolete software migration.

Post on 14-Jan-2015

1.356 views 0 download

Tags:

description

A small vademecum for obsolete PHP 4 software migration.

Transcript of PHP 4? OMG! A small vademecum for obsolete software migration.

PHP 4? OMG! A small vademecum for obsolete software migration.

Francesco Fullone, Ideato.itff AT ideato.it

Who am I

Francesco Fullone

- PHP developer since 1999

- GrUSP President

- PHP and Open Source Evangelist

- CEO @ Ideato.it

- Nerd and geek

How many of you still use

PHP 4?

Do you know that the official PHP 4 support has

ended on 8 August 2008?

Usage of PHP 4 (2008/10)

php 4 php 5

data from Nexen.net

The “Never touch a running system” rule

“Why upgrade? My servers work fine!”

But the hardware isno longer supported

and the spare parts areno longer available.

“Why upgrade? My software works fine!”

But the dependencieslibraries are outdated

and no more developed.

“Why upgrade? My code works fine!”

But the knowledge ismissed and the best

practice never applied.

Sometimes rewriting from scratch is not an option.

We need a migration plan.

A good one.

Create Tests.

Create a tests suite:

A good test suite should be both Unit and Functional.

At least we have to:

- test the core functionality (ie. Login)- test the workflows- test third party interaction- test all the classes (if the code is OO)

Acceptance Tests:

If the code can't be unit tested (phpUnit),use acceptance tests

(Selenium-IDE).

Create Tests.

Check for libs, code smells and dependancies.

Check for libs, code smells and dependancies.

- <% ASP TAG?! %>- Old global array $HTTP_*_VARS- Magic Quotes- Register Globals- Safe mode- Old PEAR/phpClasses classes- Dismissed PHP_modules

#pear install PHP_CompatInfo

Create Tests.

Check for libs, code smells and dependancies.

Rollback to thedefault PHP.INI

A lot of things changed in the PHP.INI, try to use the default values during the upgrade

process.

Enable the LOG to the Notice level.

Create Tests.

Check for libs, code smells and dependancies.

Rollback to the default PHP.INI

Upgrade PHP and the system iteratively.

Read the LOG, use the tests,

do code refactoring,upgrade the system.

Repeat this mantra

THE END?

NO!

Now it's time to do serious code refactoring:

- create proper unit tests - use standard development pattern- use an enterprise level framework

- remove unused modules

?

Francesco Fulloneff AT ideato.it

via Quinto Bucci 20547023 Cesena (FC)info AT ideato.itwww.ideato.it

www.fullo.netwww.grusp.it

www.phpday.it