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
Heroku und PHP
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Christoph Hochstrasser
November 07, 2013
Programming
0
140
Heroku und PHP
Slides from my talk at the Developer Conference 2013 in Hamburg. Not affiliated with Heroku.
Christoph Hochstrasser
November 07, 2013
Tweet
Share
More Decks by Christoph Hochstrasser
See All by Christoph Hochstrasser
VILT Stack (DevTreff Amstetten)
hochchristoph
0
72
Git Workshop @ Makerspace[A]
hochchristoph
0
49
Einstieg in Open Source
hochchristoph
0
110
Nuxt – Die Zukunft der Webentwicklung
hochchristoph
0
110
Nuxt – The Future of Web Frameworks
hochchristoph
0
34
Design Essentials für Techniker
hochchristoph
1
42
Look, no database
hochchristoph
0
240
7 Things Learned
hochchristoph
0
31
Einführung in Go
hochchristoph
0
63
Other Decks in Programming
See All in Programming
QAフローを最適化し、品質水準を満たしながらリリースまでの期間を最短化する #RSGT2026
shibayu36
2
4.4k
Automatic Grammar Agreementと Markdown Extended Attributes について
kishikawakatsumi
0
190
疑似コードによるプロンプト記述、どのくらい正確に実行される?
kokuyouwind
0
390
React 19でつくる「気持ちいいUI」- 楽観的UIのすすめ
himorishige
11
7.4k
Data-Centric Kaggle
isax1015
2
770
Patterns of Patterns
denyspoltorak
0
1.4k
[KNOTS 2026登壇資料]AIで拡張‧交差する プロダクト開発のプロセス および携わるメンバーの役割
hisatake
0
280
LLM Observabilityによる 対話型音声AIアプリケーションの安定運用
gekko0114
2
430
AIと一緒にレガシーに向き合ってみた
nyafunta9858
0
230
AI Schema Enrichment for your Oracle AI Database
thatjeffsmith
0
280
それ、本当に安全? ファイルアップロードで見落としがちなセキュリティリスクと対策
penpeen
7
3.9k
20260127_試行錯誤の結晶を1冊に。著者が解説 先輩データサイエンティストからの指南書 / author's_commentary_ds_instructions_guide
nash_efp
1
970
Featured
See All Featured
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.7k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
430
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
130
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
380
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.6k
Site-Speed That Sticks
csswizardry
13
1.1k
Code Reviewing Like a Champion
maltzj
527
40k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Automating Front-end Workflow
addyosmani
1371
200k
From π to Pie charts
rasagy
0
120
GraphQLとの向き合い方2022年版
quramy
50
14k
Transcript
Heroku & PHP
Sponsored by Heroku Not.
Christoph Hochstrasser @hochchristoph github.com/CHH Blog: christophh.net Full-Stack Web Developer –
Funemployed Contributor zu Composer, StackPHP. Creator von php-build.
Um was gehts? • Was ist Heroku? • Das Problem
mit Heroku und PHP • Buildpacks & Open Source to the rescue! • Rezepte für PHP Apps auf Heroku
Heroku? Wat?
None
her-OH-koo
Platform as a Service
Ruby, Python, Node.js, Java, Scala, Clojure, Go
(PHP) dazu später mehr
Dynos
Addons addons.heroku.com
„Buildpacks“
12factor.net
PHP
PHP Support auf Heroku ist „solala“
Problem:
PHP 5.3 + Apache Prefork MPM & mod_php + Dynos
haben nur 512MB RAM
Aber das können wir beheben. Let’s do it.
Buildpack • Erlaubt die Verwendung eines eigenen Software Stacks auf
Heroku • Pro App • Git Repository • Scripts (detect, compile, release) • Binaries von z.B. S3 • Mehr unter https://devcenter.heroku.com/articles/buildpack- api
Buildpack git push heroku master detect compile release
Darf ich vorstellen: github.com/CHH/heroku-buildpack-php
Inspiriert vom Node.js Buildpack
Moderner PHP Stack
PHP-FPM & NGINX
PHP 5.3, 5.4, 5.5 dynamisch konfigurierbar
Zend Opcache
mongo redis intl pgsql apcu + more to come
<?php phpinfo(); ?> https://chh-php-test.herokuapp.com/info
Composer
Unterstützt Symfony 2, Silex & Slim Wordpress (mit Anpassungen) In
Zukunft auch Zend Framework 1/2 & Laravel
NewRelic Monitoring
Konfiguration über composer.json
{ "require": { "php": ">=5.3.0", "silex/silex": "~1.0@dev", "ext-libevent": "*" },
"extra": { "heroku": { "document-root": "web", "index-document": "index.php", "php-config": [ "short_open_tag=on", "date.timezone=Europe/Vienna", "newrelic.appname=php-test" ], "engines": { "php": "5.4.*", "nginx": "1.4.*" }, "compile": [ ] } } } Framework php.ini Einstellungen Stack Versionen Shell Befehle Häufige Settings
„Zeroconf“ Symfony 2 Support
$ php composer.phar create-project symfony/framework-standard-edition Symfony 2.3.0 $ cd Symfony
$ heroku create —buildpack git://github.com/CHH/heroku-buildpack-php —region eu $ git push heroku master
Help Wanted! ! github.com/CHH/heroku-buildpack-php/issues
Rezepte
Lokales Development
php -S php app/console server:run
Credentials
Config Vars $ heroku config:set API_SECRET=mytotallysecretkey $_SERVER['API_SECRET']
+ änderbar ohne Code Push + nicht eingecheckt im Repository
Kandidaten für Config Vars: • S3 Bucket • Amazon Access
Key/Secret • Datenbank Host, Port, Username, Passwort, Datenbankname • Redis Host • Secrets aller Art (Facebook,…) • Application Environment
Aber wie mach ich das lokal?
.env github.com/vlucas/phpdotenv
AWS_SECRET_KEY=foo AWS_ACCESS_KEY_ID=asd8asd8ausd MY_AWESOME_CONF_VAR=foobarbaz DATABASE_URL=mysql://root:pass@localhost:6657/dbname SERVICE_URL=localhost:5000 REDIS_URL=redis://localhost:6379 REDIS_PASS=s3cr3tp4ss SERVER_NAME=localhost:3000 APP_ENV=development
Assets
JS/CSS/Images → S3 → CDN
Alternative php app/console assets:dump —env=prod
{ … "extra": { "heroku": { … "compile": [ "php
app/console assets:dump —env=prod" ] } } }
Sessions
Redis $ heroku addons:add redistogo
Datenbank
Heroku Postgres heroku addons:add heroku-postgresql
MySQL: Amazon RDS heroku addons:add amazon_rds
MongoDB $ heroku addons:add mongohq
Links • Heroku PHP Buildpack: github.com/CHH/heroku-buildpack-php • Heroku Buildpacks API:
https://devcenter.heroku.com/articles/ buildpack-api • HHVM Buildpack: https://github.com/hhvm/heroku-buildpack-hhvm
Danke!
Alle Klarheiten beseitigt? Fragen?