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
91
0
Share
PHPをGoで動かす
2025/11/19 Go Connect #10 の登壇資料です。
chiroruxx
November 19, 2025
More Decks by chiroruxx
See All by chiroruxx
初心者エンジニアから中級者エンジニアになるためにオススメの1冊
chiroruxx
0
120
Laravelのパッケージ全部紹介する
chiroruxx
2
130
Gopher のための「自由な話し合い」ワークショップ
chiroruxx
0
40
Goを使ってTDDを体験しよう!
chiroruxx
1
1k
今ならできる!PhpStormプラグイン開発
chiroruxx
0
98
Go Connectへの想い
chiroruxx
0
210
eBPF with PHPをさわる
chiroruxx
0
180
sl完全に理解したつもり
chiroruxx
0
170
命名をリントする
chiroruxx
1
1k
Other Decks in Technology
See All in Technology
Agentic Design Patterns
glaforge
0
230
layerx-fde-practices
cipepser
6
2.8k
A Harness for Behaviour: how to get AI to generate code that does what we intend, or "TDD in the age of AI"
xpmatteo
0
470
Anthropic AIネイティブ・スタートアップ構築のプレイブック を理解する
nagatsu
0
200
サプライチェーン攻撃への備えについて考えている #湘なんか
stefafafan
3
2.4k
データ分析基盤の信頼を支える視点と設計
yuki_saito
1
720
さきさん文庫の書籍ができるまで
sakiengineer
0
270
テストコードのないプロジェクトにテストを根付かせる
tttol
0
210
Java正規表現エンジン(NFA)の仕組みと パフォーマンスを維持するための最適化手法
takeuchi_132917
0
130
OpenID Connectによるサービス間連携
takesection
0
130
CloudFront VPCオリジンとVPC Latticeサービスの内部ALBをマルチアカウントで一元利用しよう
duelist2020jp
5
250
20260528_生成AIを専属DSに_Howの次にすべきことを考える
doradora09
PRO
0
220
Featured
See All Featured
4 Signs Your Business is Dying
shpigford
187
22k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
140
Paper Plane (Part 1)
katiecoart
PRO
0
7.9k
Claude Code のすすめ
schroneko
67
220k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
190
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
150
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
540
A Tale of Four Properties
chriscoyier
163
24k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
510
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
120
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
340
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で動くと言っても過言ではないかもしれ ない!! ・・・過言か