高速開發一個PHP擴充

來源:互聯網
上載者:User
快速開發一個PHP擴充
本文通過非常快速的方式講解了如何製作一個PHP 5.2 環境的擴充(PHP Extension),希望能夠在圖文的方式下讓想快速學習的朋友瞭解一下製作過程。


需求:比如開發一個叫做 heiyeluren 的擴充,擴充裡就一個函數 heiyeluren_test(),輸入一個字串,函數返回:Your input string: xxxxx。
要求:瞭解C/C++編程,熟悉PHP編程
環境:下載一份php對應版本的源碼,我這裡是 php-5.2.6,先正常安裝php,假設我們的php安裝在 /usr/local/php 目錄,源碼在 /root/soft/php/php-5.2.6/,現在開始!


步驟一:產生擴充架構


cd /root/soft/php/php-5.2.6/ext
./ext_skel --extname=heiyeluren
cd /root/soft/php/php-5.2.6/ext/heiyeluren
vi config.m4
開啟檔案後去掉 dnl ,獲得下面的資訊:
PHP_ARG_ENABLE(heiyeluren, whether to enable heiyeluren support,
[ --enable-heiyeluren Enable heiyeluren support])
儲存退出.

漂漂亮亮七仙女

兩點一刻

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.