php 4? omg! a small vademecum for obsolete software migration
DESCRIPTION
A small vademecum for obsolete PHP 4 software migration.TRANSCRIPT
![Page 1: PHP 4? OMG! A small vademecum for obsolete software migration](https://reader033.vdocument.in/reader033/viewer/2022051611/54b683174a79591b3c8b4746/html5/thumbnails/1.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022051611/54b683174a79591b3c8b4746/html5/thumbnails/2.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022051611/54b683174a79591b3c8b4746/html5/thumbnails/3.jpg)
How many of you still use
PHP 4?
![Page 4: PHP 4? OMG! A small vademecum for obsolete software migration](https://reader033.vdocument.in/reader033/viewer/2022051611/54b683174a79591b3c8b4746/html5/thumbnails/4.jpg)
![Page 5: PHP 4? OMG! A small vademecum for obsolete software migration](https://reader033.vdocument.in/reader033/viewer/2022051611/54b683174a79591b3c8b4746/html5/thumbnails/5.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022051611/54b683174a79591b3c8b4746/html5/thumbnails/6.jpg)
![Page 7: PHP 4? OMG! A small vademecum for obsolete software migration](https://reader033.vdocument.in/reader033/viewer/2022051611/54b683174a79591b3c8b4746/html5/thumbnails/7.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022051611/54b683174a79591b3c8b4746/html5/thumbnails/8.jpg)
![Page 9: PHP 4? OMG! A small vademecum for obsolete software migration](https://reader033.vdocument.in/reader033/viewer/2022051611/54b683174a79591b3c8b4746/html5/thumbnails/9.jpg)
The “Never touch a running system” rule
![Page 10: PHP 4? OMG! A small vademecum for obsolete software migration](https://reader033.vdocument.in/reader033/viewer/2022051611/54b683174a79591b3c8b4746/html5/thumbnails/10.jpg)
“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](https://reader033.vdocument.in/reader033/viewer/2022051611/54b683174a79591b3c8b4746/html5/thumbnails/11.jpg)
“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](https://reader033.vdocument.in/reader033/viewer/2022051611/54b683174a79591b3c8b4746/html5/thumbnails/12.jpg)
“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](https://reader033.vdocument.in/reader033/viewer/2022051611/54b683174a79591b3c8b4746/html5/thumbnails/13.jpg)
Sometimes rewriting from scratch is not an option.
![Page 14: PHP 4? OMG! A small vademecum for obsolete software migration](https://reader033.vdocument.in/reader033/viewer/2022051611/54b683174a79591b3c8b4746/html5/thumbnails/14.jpg)
We need a migration plan.
A good one.
![Page 15: PHP 4? OMG! A small vademecum for obsolete software migration](https://reader033.vdocument.in/reader033/viewer/2022051611/54b683174a79591b3c8b4746/html5/thumbnails/15.jpg)
Create Tests.
![Page 16: PHP 4? OMG! A small vademecum for obsolete software migration](https://reader033.vdocument.in/reader033/viewer/2022051611/54b683174a79591b3c8b4746/html5/thumbnails/16.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022051611/54b683174a79591b3c8b4746/html5/thumbnails/17.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022051611/54b683174a79591b3c8b4746/html5/thumbnails/18.jpg)
Create Tests.
Check for libs, code smells and dependancies.
![Page 19: PHP 4? OMG! A small vademecum for obsolete software migration](https://reader033.vdocument.in/reader033/viewer/2022051611/54b683174a79591b3c8b4746/html5/thumbnails/19.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022051611/54b683174a79591b3c8b4746/html5/thumbnails/20.jpg)
#pear install PHP_CompatInfo
![Page 21: PHP 4? OMG! A small vademecum for obsolete software migration](https://reader033.vdocument.in/reader033/viewer/2022051611/54b683174a79591b3c8b4746/html5/thumbnails/21.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022051611/54b683174a79591b3c8b4746/html5/thumbnails/22.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022051611/54b683174a79591b3c8b4746/html5/thumbnails/23.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022051611/54b683174a79591b3c8b4746/html5/thumbnails/24.jpg)
Read the LOG, use the tests,
do code refactoring,upgrade the system.
![Page 25: PHP 4? OMG! A small vademecum for obsolete software migration](https://reader033.vdocument.in/reader033/viewer/2022051611/54b683174a79591b3c8b4746/html5/thumbnails/25.jpg)
Repeat this mantra
![Page 26: PHP 4? OMG! A small vademecum for obsolete software migration](https://reader033.vdocument.in/reader033/viewer/2022051611/54b683174a79591b3c8b4746/html5/thumbnails/26.jpg)
THE END?
![Page 27: PHP 4? OMG! A small vademecum for obsolete software migration](https://reader033.vdocument.in/reader033/viewer/2022051611/54b683174a79591b3c8b4746/html5/thumbnails/27.jpg)
NO!
![Page 28: PHP 4? OMG! A small vademecum for obsolete software migration](https://reader033.vdocument.in/reader033/viewer/2022051611/54b683174a79591b3c8b4746/html5/thumbnails/28.jpg)
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](https://reader033.vdocument.in/reader033/viewer/2022051611/54b683174a79591b3c8b4746/html5/thumbnails/29.jpg)
?
![Page 30: PHP 4? OMG! A small vademecum for obsolete software migration](https://reader033.vdocument.in/reader033/viewer/2022051611/54b683174a79591b3c8b4746/html5/thumbnails/30.jpg)
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