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
87
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
120
Laravelのパッケージ全部紹介する
chiroruxx
2
120
Gopher のための「自由な話し合い」ワークショップ
chiroruxx
0
34
Goを使ってTDDを体験しよう!
chiroruxx
1
980
今ならできる!PhpStormプラグイン開発
chiroruxx
0
93
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
Forget technical debt
ufried
0
130
エージェントスキルを作って自分のインプットに役立てよう
tsubakimoto_s
0
490
要件定義の精度を高めるための型と生成AIの活用 / Using Types and Generative AI to Improve the Accuracy of Requirements Definition
haru860
0
220
20260423_執筆の工夫と裏側 技術書の企画から刊行まで / From the planning to the publication of technical book
nash_efp
3
680
Scovilleモバイルエンジニア募集中.pdf
julienrudin
0
140
Angular Architecture Revisited Modernizing Angular Architectural Patterns
rainerhahnekamp
0
110
AgentCore×VPCでの設計パターンn選と勘所
har1101
4
360
UIライブラリに依存しすぎないReact Native設計を目指して
grandbig
0
170
Good Enough Types: Heuristic Type Inference for Ruby
riseshia
1
380
No Types Needed, Just Callable Method Check
dak2
1
2.6k
Pure Intonation on Browser: Building a Sequencer with Ruby
nagachika
0
370
Do Vibe Coding ao LLM em Produção para Busca Agêntica - TDC 2026 - Summit IA - São Paulo
jpbonson
3
170
Featured
See All Featured
What's in a price? How to price your products and services
michaelherold
247
13k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
130
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.8k
Paper Plane
katiecoart
PRO
1
49k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
1.9k
Unsuck your backbone
ammeep
672
58k
Making the Leap to Tech Lead
cromwellryan
135
9.8k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
530
Statistics for Hackers
jakevdp
799
230k
Between Models and Reality
mayunak
3
270
Context Engineering - Making Every Token Count
addyosmani
9
850
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.2k
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で動くと言っても過言ではないかもしれ ない!! ・・・過言か