Examples of manually compiling PHP extensions memcache under Windows

Source: Internet
Author: User

This is a brief introduction to compiling PHP and its extended memcache, and it is recommended that you read the official document (address) before reading the following. Here we take php5.3 as an example.

First, the compilation environment

Select the appropriate compiler according to your PHP version:

PHP 5.3-5.4:visual C + + 9.0 (Visual Studio 2008)

PHP 5.5+: Visual C + + 11.0 (visual Studio 2012)

If it is php5.3-5.4, also download windows SDK 6.1 (download address)

Second, compile the file

1, download PHP source code, http://snaps.php.net/

2, download the PHP SDK file, http://windows.php.net/downloads/php-sdk/

So here we download the two files.

3, download Memcache expansion code package, Http://pecl.php.net/package/memcache


Third, the compilation work

1, create the compilation directory "C:\PHP_SDK"

2, decompression php-sdk-binary-tools-20110915.zip inside the file to php_sdk directory

3, in the Start menu to find and open the Windows SDK CMD Shell, and then execute

Setenv/x86/xp/release
CD PHP_SDK
Bin\phpsdk_setvars.bat
Bin\phpsdk_buildtree.bat Phpdev

After execution, the Phpdev folder is generated in the directory

4, into the C:\php_sdk\phpdev\vc9\x86\, deps-5.3-vc9-x86.7z extract to the directory, cover deps folder.

5, the PHP source code is also extracted into the x86 directory.

6, in the x86 directory to create a pecl folder, the Memcache compressed package content to the PECL directory, and the folder name memcache-2.2.7 changed to Memcache

7. Create obj folder in x86 directory to save compile-time generated files

8. Execute the following command to create the PHP compilation configuration

CD phpdev\vc9\x86\php5.3-201308211030
Buildconf
Configure--help. \configure_help.txt
Configure--disable-all--enable-snapshot-build--enable-cli--enable-cgi--enable-memcache=shared-- Enable-object-out-dir=.. \obj--enable-session

Note: The –enable-memcache=shared in the configuration means memcache to build the DLL, otherwise it will be packaged with PHP

9, compile PHP, execute the following command

Nmake

10, if you want to package PHP, execute the following command

NMAKE Snap


Here, the compile work should be over. Php_memcache.dll can be found in the C:\php_sdk\phpdev\vc9\x86\obj\ReleaseTS\ directory


Iv. concluding remarks

This article describes how to compile PHP and its own PHP extensions, and make a distinction between compiling PHP extensions eaccelerator under Windows written earlier. You can also generate which PHP extensions, depending on the x86 directory just generated help document Configure_help.txt

Original from: Lvtao.net blog

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.