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
430
初心者エンジニアから中級者エンジニアになるためにオススメの1冊
chiroruxx
0
130
Laravelのパッケージ全部紹介する
chiroruxx
2
140
Gopher のための「自由な話し合い」ワークショップ
chiroruxx
0
51
Goを使ってTDDを体験しよう!
chiroruxx
1
1.2k
今ならできる!PhpStormプラグイン開発
chiroruxx
0
120
Go Connectへの想い
chiroruxx
0
240
eBPF with PHPをさわる
chiroruxx
0
190
sl完全に理解したつもり
chiroruxx
0
180
Other Decks in Technology
See All in Technology
QAタスクをスキル化したいときに考えること
aomoriringo
0
130
DevOps Agentで運用判断をチーム資産にする~Agent InstructionsとAgent Skillを継続的に育てる~
fujioka6789
0
180
AI Agent を本番環境へ―― Microsoft Foundry × Azure Serverless で作る Enterprise-Ready な基盤
shibayan
PRO
1
920
もう一度考える SRE チームの作り方・育て方 / Rethinking SRE #1: Building and Growing SRE Teams
rrreeeyyy
1
170
ここは地獄!つらい朝会を体験することで、チームとしてのより良い振る舞いに気づくワークショップ / The stand-up meeting from hell in the game industry
scrummasudar
0
440
運用を犠牲にせずコストを制御し事業成長を支える B2B SaaS ID管理基盤におけるS3 Tableのログストレージ活用
kaminashi
1
120
個人OSSが、机の上から世界に広がるまでの話
shinyasaita
0
140
「休む」重要さ
smt7174
7
1.8k
なぜ、あなたのエージェントは言うことを聞かないのか
segavvy
1
590
基調講演:人とAIをつなぐIoTの今と未来 ー 「フィジカル」と「デジタル」が出会うその先へ【SORACOM Discovery 2026】
soracom
PRO
0
370
AI ネイティブな組織に Gemini Enterprise Agent Platform がなぜ必要なのか
asei
0
110
それでも、技術なブログを書く理由 #kichijojipm / Why I Still Write Tech Blogs Even Now
shinkufencer
0
1.4k
Featured
See All Featured
Testing 201, or: Great Expectations
jmmastey
46
8.2k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
780
Evolving SEO for Evolving Search Engines
ryanjones
0
250
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Designing for Performance
lara
611
70k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
410
New Earth Scene 8
popppiees
3
2.4k
How to train your dragon (web standard)
notwaldorf
97
6.7k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
430
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.4k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
310
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で動くと言っても過言ではないかもしれ ない!! ・・・過言か