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
100
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
PHPをGoで動かす
2025/11/19 Go Connect #10 の登壇資料です。
chiroruxx
November 19, 2025
More Decks by chiroruxx
See All by chiroruxx
Contextとはなにか
chiroruxx
1
390
初心者エンジニアから中級者エンジニアになるためにオススメの1冊
chiroruxx
0
130
Laravelのパッケージ全部紹介する
chiroruxx
2
140
Gopher のための「自由な話し合い」ワークショップ
chiroruxx
0
48
Goを使ってTDDを体験しよう!
chiroruxx
1
1.1k
今ならできる!PhpStormプラグイン開発
chiroruxx
0
110
Go Connectへの想い
chiroruxx
0
220
eBPF with PHPをさわる
chiroruxx
0
190
sl完全に理解したつもり
chiroruxx
0
180
Other Decks in Technology
See All in Technology
事業価値を⽣み出すSREへ SREが担うべき意思決定の5層
kenta_hi
0
390
End-to-Endで考える信頼性 —LINEアプリにおけるクライアント開発×SRE連携の実践
maruloop
3
790
LiDAR SLAMの実装とセンサ融合 ~Lie群からContinuous-Time LIOまで~
naokiakai
1
980
攻撃者がいなくてもAIエージェントはインシデントを起こす
nomizone
0
200
AIに障害切り分けを全部やってもらった。 。 。 。
estie
0
370
RAGの精度向上とエージェント活用
kintotechdev
2
140
初めてのDatabricks勉強会
taka_aki
2
240
ゼロをイチにする仕事が終わったあと
smasato
0
300
AIDLC_ヤフーショッピングの取り組み
lycorptech_jp
PRO
0
540
FinOps X 2026 Recap from Engineer Side #JapanFinOps
chacco38
0
260
Foxgloveについて 実際にExtensionを開発して公開するまでの話 / About Foxglove: The Story of Developing and Releasing an Extension
ry0_ka
0
150
クラウド上のデータ復旧で見落としがちな制約: 医療系 SaaS の BCP 設計から得た教訓
kakehashi
PRO
0
260
Featured
See All Featured
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
340
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.8k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.7k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Git: the NoSQL Database
bkeepers
PRO
432
67k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
180
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
370
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.3k
How STYLIGHT went responsive
nonsquared
100
6.2k
Technical Leadership for Architectural Decision Making
baasie
3
430
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で動くと言っても過言ではないかもしれ ない!! ・・・過言か