First, see phpinfo () Information
PHP Version 5.4.34
Zend Extension Build Api220100525,ts,vc9
PHP Extension Build Api20100525,ts,vc9
Thread Safety Enable
Thread Safety, VC9 compilation, 5.4.34 version
Ii. preparatory work before development
PHP 5.3-5.4:visual C + + 9.0 (Visual Studio 2008)
Install Cygwin (download address: http://www.cygwin.com/), Virtual Linux environment
PHP compiled program and pre-compiled source code (download address: http://windows.php.net/download/)
Compiled program path: php-5.4.45-win32-vc9-x86\
Pre-compiled source path: php-5.4.45-src\
Download PHP SDK file, http://windows.php.net/downloads/php-sdk/
1, unzip the php-sdk-binary-tools-20110915.zip inside the file, the Bison.exe is located in the Bin directory to add the system path
Copy Php-5.4.45-win32-vc9-x86\dev\php5ts.lib to Php-5.4.45-src\release_ts\php5ts.lib
Create a new php-5.4.45-src\main\config.win32.h with the following content:
#define Sizeof_long 4
#define PHP_COMPILER_ID "VC9"
"VC9" corresponds to VC9
2, find PHP source directory, php-5.4.45-src\ext\ext_skel_win32.php
Change this to your Cygwin installation directory.
3, run cmd, enter the PHP source directory, php-5.4.45-src\ext, Run command PHP ext_skel_win32.php--extname=myphpexs
Remember to add the Php.exe directory to path,--extname= your extension name,
If successful, the Myphpexs folder will be generated in the Ext directory, the contents are as follows
4, open MYPHPEXS.DSP with vs2008, solution configuration change to release, execute Build command
Smooth words will generate php_myphpexs.dll files, my will php_myphpexs.dll generated in the PHP source root directory Release_ts folder
5, put Php_myphpexs.dll into your PHP extension directory, and then php.ini add Extension=php_myphpexs.dll
6, the new PHP script file test.php, the content is as follows
Copy the Code code as follows:
echo confirm_myphpexs_compiled (' Test ');
7, run the test file, appears the following description, succeeded
Copy the Code code as follows:
congratulations! You have successfully modified EXT/MYPHPEXT/CONFIG.M4. Module compiled to PHP.
8, confirm_myphpexs_compiled is to build an extension is the number of the function, when you edit your own extension content, you can delete the change function