Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Upgrading from PHP 5.3 to 5.5
Search
Glen Mailer
October 05, 2013
Programming
1
1.2k
Upgrading from PHP 5.3 to 5.5
A small talk on the experiences gained from migrating from PHP 5.3 to 5.5.
Glen Mailer
October 05, 2013
Tweet
Share
More Decks by Glen Mailer
See All by Glen Mailer
Are you afraid of dependencies?
glenjamin
0
120
How to React Appropriately
glenjamin
1
500
Bumping our Stack to PHP 5.5
glenjamin
0
230
Message Queues for Everyone
glenjamin
1
160
Messages queues don't need to be scary.
glenjamin
1
99
Other Decks in Programming
See All in Programming
AI コーディングエージェントの時代へ:JetBrains が描く開発の未来
masaruhr
1
200
CDK引数設計道場100本ノック
badmintoncryer
1
250
MCPを使ってイベントソーシングのAIコーディングを効率化する / Streamlining Event Sourcing AI Coding with MCP
tomohisa
0
150
たった 1 枚の PHP ファイルで実装する MCP サーバ / MCP Server with Vanilla PHP
okashoi
1
270
PHPで始める振る舞い駆動開発(Behaviour-Driven Development)
ohmori_yusuke
2
410
“いい感じ“な定量評価を求めて - Four Keysとアウトカムの間の探求 -
nealle
2
11k
効率的な開発手段として VRTを活用する
ishkawa
0
150
RailsGirls IZUMO スポンサーLT
16bitidol
0
190
ソフトウェア品質を数字で捉える技術。事業成長を支えるシステム品質の マネジメント
takuya542
2
14k
PicoRuby on Rails
makicamel
2
140
High-Level Programming Languages in AI Era -Human Thought and Mind-
hayat01sh1da
PRO
0
830
Flutterで備える!Accessibility Nutrition Labels完全ガイド
yuukiw00w
0
170
Featured
See All Featured
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
161
15k
Building Flexible Design Systems
yeseniaperezcruz
328
39k
Facilitating Awesome Meetings
lara
54
6.5k
What’s in a name? Adding method to the madness
productmarketing
PRO
23
3.5k
Being A Developer After 40
akosma
90
590k
Making Projects Easy
brettharned
116
6.3k
Site-Speed That Sticks
csswizardry
10
690
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.4k
Designing for Performance
lara
610
69k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
281
13k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
48
2.9k
Adopting Sorbet at Scale
ufuk
77
9.5k
Transcript
None
Glen Mailer
The Codebase
First commit April 2010 60k commits since
9300 PHP files 690k lines of code According to git
and cloc
10 releases a week 35 active committers 10 concurrent streams
1 deployable
The Platform
8 Test Environments 1 Staging Environment 2 Live Environments
74 Live PHP boxes
1300 req/s peak 500k uniques/week
Why?
Using basically the same PHP version as the first commit
with security patches
PHP 5.3 is dead
Bug fixes Performance
New Features! short array syntax traits $this in closures yield
finally
but no smoking gun
Bug #64827 GC causes segfaults
The Plan
Upgrade a dev box Support 5.3 and 5.5 Pass all
tests Upgrade 1 Test env Upgrade CI Upgrade Test & Staging Incrementally Upgrade Live
Vagrant Chef Unit Tests Acceptance Tests
Hack hack hack...
3 days later
What changed?
APC becomes OPcache and APCu
Check for new function, fall back to old one if
(function_exists('opcache_reset')) { opcache_reset(); } else { apc_clear_cache(); }
“The PHP api will retain compatibility with APC, as will
common configuration options, providing a drop in replacement.” APCu
Not a drop in replacement
APCu 4.0.1 APCu 4.0.2
No more mysql_
It will not be missed
preg_replace /e becomes preg_replace_callback
(string) array() Now raises a warning Still returns “Array”
Type-checked function function inc($int) { if (!is_int($int)) { throw new
InvalidArgumentException( 'Expected int, got: ' . $int ); } return $int + 1; }
Unit test for type-checked function /** * @dataprovider provideIncInvalid */
function testIncRejectsInvalid($a) { try { inc($a); $this->fail('Expected exception'); } catch (InvalidArgumentException $ex) {} } function provideIncInvalid() { return array( null, true, "string", array() ); }
Simplest fix throw new InvalidArgumentException( 'Expected int, got: ' .
json_encode($int) );
$a = "string”; $a['index']; Now raises a warning
// protected $a; ++$this->a Now raises a warning
Progress
Upgrade a dev box Support 5.3 and 5.5 Pass all
tests Upgrade 1 Test env Upgrade CI Upgrade Test & Staging Incrementally Upgrade Live
Upgrade a dev box Support 5.3 and 5.5 Pass all
tests Upgrade 1 Test env Upgrade CI Upgrade Test & Staging Incrementally Upgrade Live
What now?
Finish Migrating Live
See if the hard to reproduce failures have stopped
Start using new features!
Keep up to date
You should upgrade too!
Fin.
Questions?
@glenathan https://joind.in/9473