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
110
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
440
初心者エンジニアから中級者エンジニアになるためにオススメの1冊
chiroruxx
0
130
Laravelのパッケージ全部紹介する
chiroruxx
2
150
Gopher のための「自由な話し合い」ワークショップ
chiroruxx
0
51
Goを使ってTDDを体験しよう!
chiroruxx
1
1.2k
今ならできる!PhpStormプラグイン開発
chiroruxx
0
120
Go Connectへの想い
chiroruxx
0
240
eBPF with PHPをさわる
chiroruxx
0
200
sl完全に理解したつもり
chiroruxx
0
190
Other Decks in Technology
See All in Technology
Go 1.27 の標準パッケージに uuid が入った!のでいろいろ喋る / go_127_std_go_uuid
convto
3
550
小粒でもパワフルなJS Runtime Antjsについて
comamoca
0
110
Eight Engineering Unit 紹介資料
sansan33
PRO
3
8.2k
Model Studio CLI × Token Plan
maigo999
0
200
作って理解するCoding Agent 〜フレームワークに頼らないピュア Python での実装〜
takapy
2
150
tamachi.go 誕生の裏側
rymiyamoto
1
190
AIにブラウザを触らせて、E2EテストをPlaywrightで書く
koji_kawamura
0
220
35分でわかるEffective Platform Engineering
nwiizo
5
550
[potatotips #96] Give Your AI Agent the Flutter Playbook
korodroid
0
120
アクセスキーが漏れた日にやるべきこと- 無効化の先にある本当の対応
kazzpapa3
0
100
【GCC2026】TrueHDRIを用いたルックデブ環境とライティングテクニック
bandainamcostudios
PRO
0
130
なぜ Temporal の大小比較には compare しかないのか / Why Does Temporal Only Have compare() for Comparisons
kazukihayase
1
190
Featured
See All Featured
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.9k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
What's in a price? How to price your products and services
michaelherold
247
13k
The browser strikes back
jonoalderson
0
1.5k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
900
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
340
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
201
75k
The Curse of the Amulet
leimatthew05
2
14k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.4k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
290
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で動くと言っても過言ではないかもしれ ない!! ・・・過言か