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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
chiroruxx
November 19, 2025
Technology
0
82
PHPをGoで動かす
2025/11/19 Go Connect #10 の登壇資料です。
chiroruxx
November 19, 2025
Tweet
Share
More Decks by chiroruxx
See All by chiroruxx
初心者エンジニアから中級者エンジニアになるためにオススメの1冊
chiroruxx
0
110
Laravelのパッケージ全部紹介する
chiroruxx
2
99
Gopher のための「自由な話し合い」ワークショップ
chiroruxx
0
29
Goを使ってTDDを体験しよう!
chiroruxx
1
910
今ならできる!PhpStormプラグイン開発
chiroruxx
0
82
Go Connectへの想い
chiroruxx
0
210
eBPF with PHPをさわる
chiroruxx
0
160
sl完全に理解したつもり
chiroruxx
0
150
命名をリントする
chiroruxx
1
990
Other Decks in Technology
See All in Technology
ガバメントクラウドにおけるAWSの長期継続割引について
takeda_h
2
5.3k
わからなくて良いなら、わからなきゃだめなの?
kotaoue
1
370
A Casual Introduction to RISC-V
omasanori
0
380
社内レビューは機能しているのか
matsuba
0
150
Google系サービスで文字起こしから勝手にカレンダーを埋めるエージェントを作った話
risatube
0
190
エンジニアリングマネージャーの仕事
yuheinakasaka
0
110
S3はフラットである –AWS公式SDKにも存在した、 署名付きURLにおけるパストラバーサル脆弱性– / JAWS DAYS 2026
flatt_security
0
1.8k
Agent ServerはWeb Serverではない。ADKで考えるAgentOps
akiratameto
0
120
AI実装による「レビューボトルネック」を解消する仕様駆動開発(SDD)/ ai-sdd-review-bottleneck
rakus_dev
0
160
最強のAIエージェントを諦めたら品質が上がった話 / how quality improved after giving up on the strongest AI agent
kt2mikan
0
200
猫でもわかるKiro CLI(AI 駆動開発への道編)
kentapapa
0
260
Everything Claude Code を眺める
oikon48
12
7.8k
Featured
See All Featured
Designing Experiences People Love
moore
143
24k
The Limits of Empathy - UXLibs8
cassininazir
1
270
My Coaching Mixtape
mlcsv
0
78
Mind Mapping
helmedeiros
PRO
1
120
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.1k
Why Our Code Smells
bkeepers
PRO
340
58k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.4k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
74
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
0
460
Exploring anti-patterns in Rails
aemeredith
2
290
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
180
Building an army of robots
kneath
306
46k
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で動くと言っても過言ではないかもしれ ない!! ・・・過言か