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
Christoph Hochstrasser
November 07, 2013
Programming
140
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Heroku und PHP
Slides from my talk at the Developer Conference 2013 in Hamburg. Not affiliated with Heroku.
Christoph Hochstrasser
November 07, 2013
More Decks by Christoph Hochstrasser
See All by Christoph Hochstrasser
VILT Stack (DevTreff Amstetten)
hochchristoph
0
83
Git Workshop @ Makerspace[A]
hochchristoph
0
55
Einstieg in Open Source
hochchristoph
0
110
Nuxt – Die Zukunft der Webentwicklung
hochchristoph
0
120
Nuxt – The Future of Web Frameworks
hochchristoph
0
38
Design Essentials für Techniker
hochchristoph
1
47
Look, no database
hochchristoph
0
250
7 Things Learned
hochchristoph
0
35
Einführung in Go
hochchristoph
0
66
Other Decks in Programming
See All in Programming
OSINT for SRE: 学術論文とポストモーテムから探る システム障害の共通パターン / SRE NEXT 2026
tomoyk
1
3.7k
吝嗇家のためのAI活用 / AI development for miser - ChatGPT + Issue Driven Development
tooppoo
0
190
【やさしく解説 設計編・中級 #4】ルールの寿命と、システムの年輪
panda728
PRO
2
130
LaravelLive Japan の裏方のすべて — 第188回 PHP勉強会@東京 (2026-06-24)
suguruooki
2
150
Generative UI & AI-Assistants for Your Angular Solutions
manfredsteyer
PRO
1
180
初めてのKubernetes 本番運用でハマった話
oku053
0
130
Apache Hive: Toward a Cloud Native Lakehouse
okumin
0
130
型も通る、synthも通る、それでも危ない 〜AIのCDKの権限とコストを機械で検証する〜 / It Passes Type Checks, It Passes Synth Checks, but It’s Still Risky — Automatically Verifying Permissions and Costs in AI’s CDK —
seike460
PRO
1
310
【やさしく解説 設計編・中級 #6】良いアーキテクチャとは ~ 一本の登り道の、行き先 ~
panda728
PRO
0
160
1B+ /day規模のログを管理する技術
broadleaf
0
140
これからAgentCoreを触る方へトレンドはGatewayです
har1101
6
490
エンジニアにデザインハーネスを 〜デザインプロセスを規定するためのハーネス〜 / Design harness from an engineer's perspective
rkaga
2
1.5k
Featured
See All Featured
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.7k
Building an army of robots
kneath
306
46k
Fireside Chat
paigeccino
42
4k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
720
The SEO Collaboration Effect
kristinabergwall1
1
500
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
800
Producing Creativity
orderedlist
PRO
348
40k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
310
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
220
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.6k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.2k
Accessibility Awareness
sabderemane
1
150
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?