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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
cccccc
moznion
0
1.8k
はじめてのWDM
miyukichi_ospf
1
120
End-to-Endで考える信頼性 —LINEアプリにおけるクライアント開発×SRE連携の実践
maruloop
3
870
実装だけじゃない! CCA-F取得エンジニアが教えるClaude Code開発プロセス活用術
diggymo
2
120
FinOps X 2026 Recap from Engineer Side #JapanFinOps
chacco38
0
260
生成AIの活用/high_school2026
okana2ki
0
110
RAGの精度向上とエージェント活用
kintotechdev
2
140
環境凍結という Toil を倒す -セルフサービス型 Ephemeral テスト環境の 設計と実践
shirouz
1
250
Empower GenAI with Agile - あなたのアジャイルが生成AIのバフになる仕組み
hageyahhoo
0
120
プライバシー保護の理論と実践
lycorptech_jp
PRO
1
240
なぜ人は自分のプロジェクトを 「なんちゃってアジャイル」と 自嘲するのか
kozotaira
0
250
AI時代のエンジニアキャリアについて今一度考える
sakamoto_582
1
1.2k
Featured
See All Featured
Code Review Best Practice
trishagee
74
20k
Leo the Paperboy
mayatellez
8
1.9k
Skip the Path - Find Your Career Trail
mkilby
1
160
Information Architects: The Missing Link in Design Systems
soysaucechin
0
1k
What's in a price? How to price your products and services
michaelherold
247
13k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
340
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Building Flexible Design Systems
yeseniaperezcruz
330
40k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
380
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
890
Designing for Timeless Needs
cassininazir
1
270
Making the Leap to Tech Lead
cromwellryan
135
10k
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で動くと言っても過言ではないかもしれ ない!! ・・・過言か