詳解Window7 下開發php擴充,詳解window7php擴充_PHP教程

來源:互聯網
上載者:User

詳解Window7 下開發php擴充,詳解window7php擴充


一、首先查看phpinfo() 資訊

PHP Version 5.4.34
Zend Extension Build API220100525,TS,VC9
PHP Extension Build API20100525,TS,VC9
Thread Safety enable

安全執行緒,VC9編譯,5.4.34版本

二、開發前準備工作

php 5.3-5.4 :Visual C++ 9.0(Visual Studio 2008)
安裝Cygwin(下載地址:http://www.cygwin.com/),虛擬linux環境
php編譯後的程式和編譯前的源碼(下載地址:http://windows.php.net/download/)
編譯後的程式路徑:php-5.4.45-Win32-VC9-x86\
編譯前的源碼路徑:php-5.4.45-src\
下載php sdk檔案,http://windows.php.net/downloads/php-sdk/

1、解壓php-sdk-binary-tools-20110915.zip裡面的檔案,將bison.exe所在的bin目錄添加的系統path

將php-5.4.45-Win32-VC9-x86\dev\php5ts.lib 複製到php-5.4.45-src\Release_TS\php5ts.lib
建立php-5.4.45-src\main\config.win32.h,內容如下:
#define SIZEOF_LONG 4
#define PHP_COMPILER_ID "VC9"
"VC9"對應VC9

2、找到php源碼目錄, php-5.4.45-src\ext\ext_skel_win32.php

/*This script can be used on Win systems) Make sure you have CygWin installed) Adjust the $cygwin_path to match your installation) Change the environment cariable PATHEXT to include .PHP) run ext_skel --extname=...the first time you run this script you will be asked toassociate it with a program. chooses the CLI version of php.*/$cygwin_path = 'D:\Program Files\cygwin\bin'; 

這裡改成你的cygwin安裝目錄。

3、運行cmd,進入php源碼目錄, php-5.4.45-src\ext,運行命令php ext_skel_win32.php --extname=myphpexs


記得將php.exe 所在目錄加入path,--extname=你的副檔名字,

若成功會再ext目錄下產生myphpexs檔案夾,內容如下


4、用vs2008 開啟myphpexs.dsp, 解決方案配置改為Release,執行產生命令

順利的話將產生php_myphpexs.dll檔案,我的將php_myphpexs.dll產生再了php源碼根目錄的Release_TS檔案夾中

5、將php_myphpexs.dll放到你php的擴充目錄,再php.ini中加上extension=php_myphpexs.dll

6、建立php指令檔test.php,內容如下

複製代碼 代碼如下:
echo confirm_myphpexs_compiled('test');

7、運行測試檔案,出現如下內容說明,成功了

複製代碼 代碼如下:
Congratulations! You have successfully modified ext/myphpext/config.m4. Module 23 is now compiled into PHP.

8、confirm_myphpexs_compiled是建立擴充是內建的冊數函數,在編輯你自己的擴充內容時,可以刪除改函數

您可能感興趣的文章:

  • windows下開發並編譯PHP擴充的方法
  • windows7下安裝php的imagick和imagemagick擴充教程
  • windows7下安裝php的php-ssh2擴充教程
  • windows 2008 R2 64位伺服器中開啟php curl擴充的方法
  • windows下配置php5.5開發環境及開發擴充

http://www.bkjia.com/PHPjc/1087277.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/1087277.htmlTechArticle詳解Window7 下開發php擴充,詳解window7php擴充 一、首先查看phpinfo() 資訊 PHP Version 5.4.34 Zend Extension Build API220100525,TS,VC9 PHP Extension Build API2010...

  • 聯繫我們

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