開發PHP擴充(一)

來源:互聯網
上載者:User

先按照

https://github.com/walu/phpbook/blob/master/5.1.md 

 

建好擴充的結構 ,三個關鍵的檔案都要有:

config.m4

php_extname.h

extname.c

 

然後,把三個檔案裡面的WALU/walu 替換為相應的extname  注意大小寫 

 

然後運行:

 

phpize 

./configure --enable-extname 

make

make install

 

擴充就弄好了.

 

只是我在按照連結的文章建立的時候,碰到一個問題,擴充編譯好了,可是載入到php的時候,老是提示錯誤:

 

Invalid library (maybe not a PHP library) 'tonic.so'

 

然後,objdump -T tonic.so  發現沒有找到符號 ,get_module,

我就知道問題出在ZEND_GET_MODULE宏上,

最後替換COMPILE_DL_SAMPLE為COMPILE_DL_TONIC

就OK了 

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.