30
PHP 4? OMG! A small vademecum for obsolete software migration. Francesco Fullone, Ideato.it ff AT ideato.it

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

Embed Size (px)

DESCRIPTION

A small vademecum for obsolete PHP 4 software migration.

Citation preview

Page 1: 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

Page 2: PHP 4? OMG! A small vademecum for obsolete software migration

Who am I

Francesco Fullone

- PHP developer since 1999

- GrUSP President

- PHP and Open Source Evangelist

- CEO @ Ideato.it

- Nerd and geek

Page 3: PHP 4? OMG! A small vademecum for obsolete software migration

How many of you still use

PHP 4?

Page 4: PHP 4? OMG! A small vademecum for obsolete software migration
Page 5: PHP 4? OMG! A small vademecum for obsolete software migration

Do you know that the official PHP 4 support has

ended on 8 August 2008?

Page 6: PHP 4? OMG! A small vademecum for obsolete software migration
Page 7: PHP 4? OMG! A small vademecum for obsolete software migration

Usage of PHP 4 (2008/10)

php 4 php 5

data from Nexen.net

Page 8: PHP 4? OMG! A small vademecum for obsolete software migration
Page 9: PHP 4? OMG! A small vademecum for obsolete software migration

The “Never touch a running system” rule

Page 10: PHP 4? OMG! A small vademecum for obsolete software migration

“Why upgrade? My servers work fine!”

But the hardware isno longer supported

and the spare parts areno longer available.

Page 11: PHP 4? OMG! A small vademecum for obsolete software migration

“Why upgrade? My software works fine!”

But the dependencieslibraries are outdated

and no more developed.

Page 12: PHP 4? OMG! A small vademecum for obsolete software migration

“Why upgrade? My code works fine!”

But the knowledge ismissed and the best

practice never applied.

Page 13: PHP 4? OMG! A small vademecum for obsolete software migration

Sometimes rewriting from scratch is not an option.

Page 14: PHP 4? OMG! A small vademecum for obsolete software migration

We need a migration plan.

A good one.

Page 15: PHP 4? OMG! A small vademecum for obsolete software migration

Create Tests.

Page 16: PHP 4? OMG! A small vademecum for obsolete software migration

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)

Page 17: PHP 4? OMG! A small vademecum for obsolete software migration

Acceptance Tests:

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

(Selenium-IDE).

Page 18: PHP 4? OMG! A small vademecum for obsolete software migration

Create Tests.

Check for libs, code smells and dependancies.

Page 19: PHP 4? OMG! A small vademecum for obsolete software migration

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

Page 20: PHP 4? OMG! A small vademecum for obsolete software migration

#pear install PHP_CompatInfo

Page 21: PHP 4? OMG! A small vademecum for obsolete software migration

Create Tests.

Check for libs, code smells and dependancies.

Rollback to thedefault PHP.INI

Page 22: PHP 4? OMG! A small vademecum for obsolete software migration

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.

Page 23: PHP 4? OMG! A small vademecum for obsolete software migration

Create Tests.

Check for libs, code smells and dependancies.

Rollback to the default PHP.INI

Upgrade PHP and the system iteratively.

Page 24: PHP 4? OMG! A small vademecum for obsolete software migration

Read the LOG, use the tests,

do code refactoring,upgrade the system.

Page 25: PHP 4? OMG! A small vademecum for obsolete software migration

Repeat this mantra

Page 26: PHP 4? OMG! A small vademecum for obsolete software migration

THE END?

Page 27: PHP 4? OMG! A small vademecum for obsolete software migration

NO!

Page 28: PHP 4? OMG! A small vademecum for obsolete software migration

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

Page 29: PHP 4? OMG! A small vademecum for obsolete software migration

?

Page 30: PHP 4? OMG! A small vademecum for obsolete software migration

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