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
Introduction of php-ext by rust
Search
gong023
January 14, 2016
Programming
13k
0
Share
Introduction of php-ext by rust
ごく簡単なphp拡張をrustで作る手順
gong023
January 14, 2016
Other Decks in Programming
See All in Programming
forteeの改修から振り返るPHPerKaigi 2026
muno92
PRO
3
110
ロボットのための工場に灯りは要らない
watany
12
3.3k
GoのDB アクセスにおける 「型安全」と「柔軟性」の両立 - Bob という選択肢
tak848
0
290
AI-DLC 入門 〜AIコーディングの本質は「コード」ではなく「構造」〜 / Introduction to AI-DLC: The Essence of AI Coding Is Not “Code” but “Structure”
seike460
PRO
0
150
Linux Kernelの1文字のミスで 権限昇格ができた話
rqda
0
2.2k
ポーリング処理廃止によるイベント駆動アーキテクチャへの移行
seitarof
3
1.3k
20260313 - Grafana & Friends Taipei #1 - Kubernetes v1.36 的開發雜記:那些困在 Alpha 加護病房太久的 Metrics
tico88612
0
240
生成 AI 時代のスナップショットテストってやつを見せてあげますよ(α版)
ojun9
0
330
Feature Toggle は捨てやすく使おう
gennei
0
400
車輪の再発明をしよう!PHP で実装して学ぶ、Web サーバーの仕組みと HTTP の正体
h1r0
2
470
ネイティブアプリとWebフロントエンドのAPI通信ラッパーにおける共通化の勘所
suguruooki
0
230
Symfonyの特性(設計思想)を手軽に活かす特性(trait)
ickx
0
110
Featured
See All Featured
The Mindset for Success: Future Career Progression
greggifford
PRO
0
290
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
My Coaching Mixtape
mlcsv
0
91
Abbi's Birthday
coloredviolet
2
6.2k
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2k
Become a Pro
speakerdeck
PRO
31
5.9k
SEO for Brand Visibility & Recognition
aleyda
0
4.4k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
110
Paper Plane (Part 1)
katiecoart
PRO
0
6.2k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
5.5k
Designing for Timeless Needs
cassininazir
0
180
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Transcript
Introduction of php-ext by rust
About me • gong023 • https://github.com/gong023/ • PHP developer of
• #mercari_wakate??
I — PHP
Interested in rust
rust is • supported by Mozilla • to replace Firefox
engine • better C++ • golang is better C
rust is good because…
Safe memory You can compile errors with dangerous memory operations
Safe memory You can compile errors with dangerous memory operations
Modern syntax • Optional
Modern syntax • Generics & Traits
create php-ext by rust
Overview 1. Create shared object file by rust 2. Test
shared object file by C 3. Link shared object file from php-ext
Create .so file by rust 1. cargo new 2. write
a function in rust 3. cargo build • you can get *.so file
Test .so file by C 1. Write test code in
C 2. Include .so and compile C test code • Don’t forget to link shared object • gcc test.c -L SO_PATH -php_ext
Link .so file from php-ext 1. Create php-ext by ext-skel
2. Edit config.m4 and configure • difficult…
Link .so file from php-ext • Edit config.m4 I don’t
know why it doesn’t work
Link .so file from php-ext • Edit config.m4 I added
a path ignoring errors
Link .so file from php-ext 3. Write .h and .c
in php-ext • see references to know more details 4. make && make install 5. Test
Advanced • I tried to export rust-carbon to php-ext •
https://github.com/gong023/rust-carbon • But I don’t succeed yet. I don’t know why it doesn’t work
References • http://hermanradtke.com/2015/08/03/ creating-a-php-extension-to-rust.html • https://github.com/hjr3/rust-php-ext • http://postd.cc/creating-a-php-extension-in- rust/