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.3k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
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
More Decks by Glen Mailer
See All by Glen Mailer
Are you afraid of dependencies?
glenjamin
0
160
How to React Appropriately
glenjamin
1
590
Bumping our Stack to PHP 5.5
glenjamin
0
280
Message Queues for Everyone
glenjamin
1
220
Messages queues don't need to be scary.
glenjamin
1
140
Other Decks in Programming
See All in Programming
AIが無かった頃の素敵な出会いの話
codmoninc
1
430
TSX の <Hoge<Fuga>> という構文に驚いた話 / tsx-type-argument-syntax
kanaru0928
0
230
AWS DevOps AgentのAzure接続機能を検証して見えた活用法/Use Cases Verified for the AWS DevOps Agent's Azure Connectivity Feature
masakiokuda
1
230
5分で問診!Composer セキュリティ健康診断
codmoninc
0
1k
Go 1.27 における memory allocation の高速化
andpad
0
180
AWS CDK を「作」ってみた 〜フルスクラッチで見えた CDK の裏側〜 / aws-cdk-from-scratch
gotok365
3
2.8k
使いながら育てる Claude Code — 開発フローの1コマンド化 × 繰り返し指摘の自動仕組み化
shiki_kakaku
0
1.8k
VibeCodingからAgenticWorkflowへ
starfish719
0
460
AI時代のPHPer生存戦略 ~「言語、もうなんでもよくない?」に本気で向き合う~
vivion
0
430
いまどきの Codex で開発する visionOS アプリの開発スタイルについて
karad
0
140
Claude Code全社展開のためにやったことn選~プラグイン302個・コミッター271人を支えるために~
kenchan
5
1.5k
為什麼你並不需要ViewModel / No, you don't need a ViewModel
lovee
1
500
Featured
See All Featured
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
1.2k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.6k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.8k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.2k
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
790
How to build a perfect <img>
jonoalderson
1
5.9k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
390
Are puppies a ranking factor?
jonoalderson
1
3.8k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.7k
Abbi's Birthday
coloredviolet
3
9.3k
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