VIP Call Girl Jamshedpur Aashi 8250192130 Independent Escort Service Jamshedpur
Why Migrate from PHP4 to PHP5: Performance, Security and Future-Proofing
1. From PHP4 to PHP5
Why you should migrate
Ivo Jansch <ivo@ibuildings.nl>
Ibuildings.nl BV
2. Contents
• About me
• The end of life of PHP4
• The benefits of PHP5
• Product support
The migration process
•
• Q&A
Tuesday 25 September 2007 2
3. About me
• CTO at Ibuildings
PHP consultancy, development & support
Netherlands and UK based
Official representative of Zend
http://www.achievo.org/blog
http://www.ibuildings.nl
• Geek
Author of several open source projects
Interested in Internet, Web 2.0, PHP
Tuesday 25 September 2007 3
4. The end of life of PHP4
• PHP.net official announcement
PHP4 support is going to end in December 2007
Only critical security fixes until 8-8-8
No support for PHP4 after 8-8-8!
• Gophp5.org
Community effort to migrate projects to PHP5
No releases for PHP4 after February 5th, 2008
Supported by major projects such as Drupal, Gallery,
PEAR, phpMyAdmin, Symfony and Typo3
Tuesday 25 September 2007 4
5. Why migrate now?
• You still have the time to migrate, on your own
terms, with your own planning.
• What if you don't migrate?
• Doom scenario: major security bug discovered in
PHP4 after 8-8-8
Only solution: migrate
Migration done under stress...
Rush job...
Badly tested...
Tuesday 25 September 2007 5
6. Benefits of PHP5
• Performance
• Maintainability
• Robustness
• Ready for the future
Tuesday 25 September 2007 6
7. Performance
Benchmark done by Sebastian Bergmann. Full article at:
http://sebastian-bergmann.de/archives/634-PHP-GCC-ICC-Benchmark.html
Tuesday 25 September 2007 7
8. Maintainability
• A new object model
Abstract classes
Interfaces
Encapsulation (private, public, protected)
• SPL
• Easier to apply proper architecture
Cleaner codebase
Easier to read
Simpler to maintain
Tuesday 25 September 2007 8
9. Robustness
• Exception Handling
Problematic situations handled gracefully
Error handling not only part of code, but also of design
try
{
// regular code
}
catch (Exception e)
{
// What to do in case of an error
}
Cleaner code -> increased productivity
& more robust
Tuesday 25 September 2007 9
10. Ready for the future
• “Web 2.0”
Web Services
RSS (XML)
Ajax
Mashups
• PHP has core functionality to support all of this
Tuesday 25 September 2007 10
11. Ready for the future
• Web Services (SOAP)
Client is as easy as:
$ws = new SoapClient(“http://someweatherservice.com/?WSDL”);
$weather = $ws->getWeather(“Amsterdam”);
Server is as easy as:
$server = new SoapServer(“calculator.wsdl”);
$server->setObject(new myCalculator());
$server->handle();
• How many lines did that take in PHP4?
Tuesday 25 September 2007 11
12. Ready for the future
• XML
1 line of code to parse XML
OO access to the contents
$xmldata = simplexml_load_file(quot;products.xmlquot;);
foreach($xmldata->products as $product)
{
echo $product->manufacturer->name;
}
Tuesday 25 September 2007 12
13. Product support
• Zend Framework
PHP5 framework
Use at Will architecture
http://framework.zend.com
• Zend Core
Maintaining your PHP infrastucture
Keep track of updates
Get support
• Many third party tools
Tuesday 25 September 2007 13
14. The Migration Process
2 phases:
• Compatibility migration
Make things work
End-of-life reasons
Performance benefits
• Code migration
Make use of new PHP5 functionality
All the other benefits
Tuesday 25 September 2007 14
15. Compatibility Migration
• Take into account:
The new object model
Name clashes
Some backwards incompatibilities
Compatibility with new default settings
• Guidelines:
http://www.php.net/manual/en/migration5.php
Tuesday 25 September 2007 15
16. Compatibility Migration
• Process:
Run unit tests (if you have them)
Do manual tests
Fix what you find
Repeat
• Important: change as little as possible
Tuesday 25 September 2007 16
17. Code Migration
• Take advantage of PHP5 features
Revise your architecture (OO)
Implement Exception Handling
Replace legacy code with PHP5 functionality
• You don't have to do this overnight
Incremental changes
Not all features at once
Refactor
Weigh benefits and costs
Tuesday 25 September 2007 17
18. Important
• Take Migration seriously
Create a planning
Don't wait until 8-8-8
Take time for testing
• Get help
Zend has migration services
Use the documentation
Ask the community
Consider training
Tuesday 25 September 2007 18
20. More info
• Visit these websites for more information:
http://www.php.net
http://www.zend.com
http://www.php.net/manual/en/migration5.php
http://www.gophp5.org
http://www.achievo.org/blog
• ivo@ibuildings.nl
• Thank you!
Tuesday 25 September 2007 20