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.1k
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
62
How to React Appropriately
glenjamin
1
420
Bumping our Stack to PHP 5.5
glenjamin
0
190
Message Queues for Everyone
glenjamin
1
130
Messages queues don't need to be scary.
glenjamin
1
94
Other Decks in Programming
See All in Programming
CSC307 Lecture 09
javiergs
PRO
1
500
CSC307 Lecture 10
javiergs
PRO
0
310
最古の関数型言語「Lisp」ことはじめ / lisp_in_kamiyama
uhooi
1
190
ドメイン駆動設計の実践
masuda220
PRO
17
5.1k
CSC307 Lecture 11
javiergs
PRO
0
240
Microservices rules (July 2024) : what good looks like
cer
PRO
0
1.6k
Ruby メモリ管理 プログラミング
megmogmog1965
0
130
AWSでゲームサーバーを運用! Amazon GameLiftのお話
iriikeita
0
200
[After Kotlin Fest 2024 LT Night @ Sansan] もっともっとKotlinを好きになる!K2 Compiler Pluginで遊んでみよう!
kitakkun
2
260
リハビリmruby
kishima
1
160
CSC307 Lecture 08
javiergs
PRO
0
330
I/O Extended Android in Korea 2024 ~ Whats new in Android development tools
pluu
0
250
Featured
See All Featured
Teambox: Starting and Learning
jrom
130
8.6k
Typedesign – Prime Four
hannesfritz
37
2.2k
Leading Effective Engineering Teams 2024
addyosmani
3
300
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
121
18k
How to Think Like a Performance Engineer
csswizardry
4
590
The World Runs on Bad Software
bkeepers
PRO
63
11k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
149
45k
How to name files
jennybc
67
96k
Put a Button on it: Removing Barriers to Going Fast.
kastner
58
3.3k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
44
4.7k
Thoughts on Productivity
jonyablonski
64
4.1k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
155
14k
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