Home  >  Article  >  Backend Development  >  Compilation of PHP and Php extensions, and compilation of extension dll files in Windows environment

Compilation of PHP and Php extensions, and compilation of extension dll files in Windows environment

WBOY
WBOYOriginal
2016-08-08 09:24:381309browse

During the work process, it is necessary to compile the DLL format file of the PHP extension. After a day of tossing, it was finally compiled. The following is an example of compiling the runkit extension under PHP5.3.28. For the official PHP compilation process in the Windows environment, please refer to the following two articles. :

https://wiki.php.net/internals/windows/stepbystepbuild

http://blog.csdn.net/mycwq/article/details/10165955

php5.3.28, compiled by runkit

The process is basically consistent with the documentation. Note that it is recommended to download the latest runkit source code from github, otherwise there is no possibility of compilation errors

runkit:

https://github.com/zenovich/runkit

Compile php in the windows environment The most difficult part is setting up the environment, including vs2008 installation and windows SDK6.1 installation. After the environment is set up

Compilation work

1. Create the compilation directory "C:php_sdk"

2. Unzip the files in php-sdk-binary-tools-20110915.zip to the php_sdk directory

3. In Find and open the Windows SDK CMD Shell on the Start menu (Note it must be the shell of the SDK, not the cmd window for DOS operations), and then execute

[plain] view plaincopy

  1. setenv /x86 /xp /release //This sentence must be executed successfully, otherwise it will not compile successfully
  2. cd php_sdk
  3. binphpsdk_setvars .bat
  4. binphpsdk_buildtree.bat phpdev

After execution, the phpdev folder will be generated in the directory

4. Enter C:php_sdkphpdevvc9x86, extract deps-5.3-vc9-x86.7z to the directory, and overwrite the deps folder. (php sdk)

5. Unzip the php source code to the x86 directory.

6. Extract the contents of the runkit compressed package to the ext directory under the decompressed source code of PHP, and change the folder name runkit-master to runkit

7. Create an obj folder in the x86 directory to save the compile time Generated file

8. Execute the following command to create PHP compilation configuration

[plain] view plaincopy

  1. cd phpdevvc9x86php5.3-201308211030
  2. buildconf
  3. configure --help >..configure_help.txt
  4. configure --disable-all --enable-cli -- enable-runkit=shared --enable-object-out-dir=..obj

Note: --enable-runkit=shared in the configuration means that memcache is generated in the form of dll, otherwise it is integrated with php .

If you are prompted that bison.exe does not exist, execute the command and then perform the following operations again (After the above configuration, bison.exe should be in the c:php_sdkbin directory. Just put this directory in the environment variable. )

[plain] view plaincopy

  1. set path=%path%;C:php_sdkbin

9. Compile php and execute the following command

[plain] view plaincopy

  1. nmake

10. If you want to package php, execute the following command

[plain] view plaincopy

  1. nmake snap

At this point, the compilation work should be over. php_memcache.dll can be found in the C:php_sdkphpdevvc9x86objReleaseTS directory


The above introduces the compilation of PHP and Php extensions and the compilation of extended dll files in the Windows environment, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn