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
PHPをGoで動かす
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
chiroruxx
November 19, 2025
Technology
86
0
Share
PHPをGoで動かす
2025/11/19 Go Connect #10 の登壇資料です。
chiroruxx
November 19, 2025
More Decks by chiroruxx
See All by chiroruxx
初心者エンジニアから中級者エンジニアになるためにオススメの1冊
chiroruxx
0
110
Laravelのパッケージ全部紹介する
chiroruxx
2
110
Gopher のための「自由な話し合い」ワークショップ
chiroruxx
0
33
Goを使ってTDDを体験しよう!
chiroruxx
1
940
今ならできる!PhpStormプラグイン開発
chiroruxx
0
90
Go Connectへの想い
chiroruxx
0
210
eBPF with PHPをさわる
chiroruxx
0
170
sl完全に理解したつもり
chiroruxx
0
160
命名をリントする
chiroruxx
1
1k
Other Decks in Technology
See All in Technology
Oracle Cloud Infrastructure(OCI):Onboarding Session(はじめてのOCI/Oracle Supportご利⽤ガイド)
oracle4engineer
PRO
2
17k
Oracle AI Database@Google Cloud:サービス概要のご紹介
oracle4engineer
PRO
6
1.3k
BIツール「Omni」の紹介 @Snowflake中部UG
sagara
0
240
プロダクトを触って語って理解する、チーム横断バグバッシュのすすめ / 20260411 Naoki Takahashi
shift_evolve
PRO
1
210
AWSで2番目にリリースされたサービスについてお話しします(諸説あります)
yama3133
0
130
スクラムを支える内部品質の話
iij_pr
0
320
OCI技術資料 : ロード・バランサ 概要 - FLB・NLB共通
ocise
4
28k
AI前提とはどういうことか
daisuketakeda
0
150
制約を設計する - 非決定性との境界線 / Designing constraints
soudai
PRO
6
2.3k
ふりかえりがなかった職能横断チームにふりかえりを導入してみて学んだこと 〜チームのふりかえりを「みんなで未来を考える場」にするプロローグ設計〜
masahiro1214shimokawa
0
230
AIがコードを書く時代の ジェネレーティブプログラミング
polidog
PRO
3
610
🀄️ on swiftc
giginet
PRO
0
130
Featured
See All Featured
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
2.7k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
330
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
First, design no harm
axbom
PRO
2
1.2k
WCS-LA-2024
lcolladotor
0
520
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
1
3.5k
The Pragmatic Product Professional
lauravandoore
37
7.2k
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
Evolving SEO for Evolving Search Engines
ryanjones
0
170
How to Talk to Developers About Accessibility
jct
2
170
It's Worth the Effort
3n
188
29k
A Modern Web Designer's Workflow
chriscoyier
698
190k
Transcript
GoでPHPを動かす 2025/11/19(水) GoConnect #10
⾃⼰紹介 ちひろ X: @chiroruxxxx 株式会社モリサワ
PHP on Go PHPの世界ではGoの上でPHPを動かす技術が話題になって るらしい お遊びではなく、プロダクションに投入され始めているとか…
FrankenPHP
なんかすごい 元々は個人プロジェクト だが、PHPコミュニティでメ ンテされるように Laravel で正式にサポート されたり
FrankenPHP の魅⼒ 色々あるが・・・ 個人的にはGoのコンテナフレンドリーさを享受できるところ
そろそろGoの話に・・・
frankenphp
サンプルコード func main() { code := ` $apple = 'red';
$banana = 'yellow'; $selected = 'banana'; echo "{$selected} is {$$selected}"; ` os.Exit( frankenphp.ExecutePHPCode(code) ) }
どのようにPHPを 動かしているのか
サンプルコード func main() { code := ` $apple = 'red';
$banana = 'yellow'; $selected = 'banana'; echo "{$selected} is {$$selected}"; ` os.Exit( frankenphp.ExecutePHPCode(code) ) }
ExecutePHP Code func ExecutePHPCode(phpCode string) int { // Ensure extensions
are registered before CLI execution registerExtensions() cCode := C.CString(phpCode) defer C.free(unsafe.Pointer(cCode)) return int( C.frankenphp_execute_script_cli( cCode, 0, nil, true ) ) }
frankenphp _execute _script_cli int frankenphp_execute_script_cli(char *script, int argc, char **argv,
bool eval) { // ... err = pthread_create(&thread, NULL, execute_script_cli, (void *)eval); if (err != 0) { return err; } err = pthread_join(thread, &exit_status); if (err != 0) { return err; } return (intptr_t)exit_status; }
execute _script_cli static void *execute_script_cli(void *arg) { // ... zend_first_try
{ if (eval) { zend_eval_string_ex(cli_script, NULL, "Command line code", 1); } else { // ... } } zend_end_try(); exit_status = (void *)(intptr_t)EG(exit_status); php_embed_shutdown(); return exit_status; }
zend_eval _string_ex
つまり 1. go 2. →cgo 3. →c 4. →php
まとめ Cで書かれた言語であればGoで動かせる? 言語側にembedする機能が必要ではある 多くの言語が実質Goで動くと言っても過言ではないかもしれ ない!! ・・・過言か