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
chiroruxx
November 19, 2025
Technology
88
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
990
今ならできる!PhpStormプラグイン開発
chiroruxx
0
94
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
Angular Architecture Revisited Modernizing Angular Architectural Patterns
rainerhahnekamp
0
120
ファインディの事業拡大を支える 拡張可能なデータ基盤へのリアーキテクチャ
hiracky16
0
760
フロントエンドの相手が変わった - AIが加わったWebの新しいインターフェース設計
azukiazusa1
29
7.6k
はじめての MagicPod生成AI機能 機能紹介から活用方法まで
magicpod
0
130
VespaのParent Childを用いたフィードパフォーマンスの改善
taking
0
180
アクセシビリティはすべての人のもの
tomokusaba
0
220
生成AIはソフトウェア開発の革命か、ソフトウェア工学の宿題再提出なのか -ソフトウェア品質特性の追加提案-
kyonmm
PRO
2
770
AWS Transform CustomでIaCコードを自由自在に変換しよう
duelist2020jp
0
230
独断と偏見で試してみる、 シングル or マルチエージェント どっちがいいの?
shichijoyuhi
1
230
『生成AI時代のクレデンシャルとパーミッション設計 — Claude Code を起点に』の執筆企画
takuros
2
2k
Shipping AI Agents — Lessons from Production
vvatanabe
0
310
COBOL婆さんの伝説
poropinai1966
0
130
Featured
See All Featured
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
190
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
380
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
760
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Skip the Path - Find Your Career Trail
mkilby
1
110
jQuery: Nuts, Bolts and Bling
dougneiner
66
8.4k
ラッコキーワード サービス紹介資料
rakko
1
3.2M
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
65
55k
Thoughts on Productivity
jonyablonski
76
5.1k
Statistics for Hackers
jakevdp
799
230k
Making Projects Easy
brettharned
120
6.6k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
910
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で動くと言っても過言ではないかもしれ ない!! ・・・過言か