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
0
75
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
95
Laravelのパッケージ全部紹介する
chiroruxx
2
77
Gopher のための「自由な話し合い」ワークショップ
chiroruxx
0
21
Goを使ってTDDを体験しよう!
chiroruxx
1
820
今ならできる!PhpStormプラグイン開発
chiroruxx
0
73
Go Connectへの想い
chiroruxx
0
200
eBPF with PHPをさわる
chiroruxx
0
150
sl完全に理解したつもり
chiroruxx
0
140
命名をリントする
chiroruxx
1
960
Other Decks in Technology
See All in Technology
SREが向き合う大規模リアーキテクチャ 〜信頼性とアジリティの両立〜
zepprix
0
400
名刺メーカーDevグループ 紹介資料
sansan33
PRO
0
1k
オープンウェイトのLLMリランカーを契約書で評価する / searchtechjp
sansan_randd
3
650
Deno・Bunの標準機能やElysiaJSを使ったWebSocketサーバー実装 / ラーメン屋を貸し切ってLT会! IoTLT 2026新年会
you
PRO
0
290
Agile Leadership Summit Keynote 2026
m_seki
1
380
顧客との商談議事録をみんなで読んで顧客解像度を上げよう
shibayu36
0
150
使いにくいの壁を突破する
sansantech
PRO
1
120
Contract One Engineering Unit 紹介資料
sansan33
PRO
0
13k
学生・新卒・ジュニアから目指すSRE
hiroyaonoe
2
540
Meshy Proプラン課金した
henjin0
0
240
会社紹介資料 / Sansan Company Profile
sansan33
PRO
15
400k
Frontier Agents (Kiro autonomous agent / AWS Security Agent / AWS DevOps Agent) の紹介
msysh
3
140
Featured
See All Featured
Designing for humans not robots
tammielis
254
26k
Evolving SEO for Evolving Search Engines
ryanjones
0
120
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.7k
Side Projects
sachag
455
43k
Optimizing for Happiness
mojombo
379
71k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
0
270
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
7.9k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
240
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
640
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
9.9k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
130
GraphQLとの向き合い方2022年版
quramy
50
14k
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で動くと言っても過言ではないかもしれ ない!! ・・・過言か