Use windowssdk on windows to compile php source code

Source: Internet
Author: User
Tags vc9
In windows using windowssdk compiling php source code recommended this article: vladimirbarbarosh.blogspot.com201105compile-php-536-pecl-libevent-004.html in order to facilitate everyone to read, the content will be reproduced to everyone, but still encourage to see the original blog. Compilephp-5.3.6 + pec use windows sdk to compile php source code on windows
Recommended This article: http://vladimirbarbarosh.blogspot.com/2011/05/compile-php-536-pecl-libevent-004.html
To facilitate reading, I will repost the content to you, but I still encourage you to read original blog posts.
Compile php-5.3.6 + pecl-libevent-0.0.4 + libevent-2.0.11-stable
Yesterday a friend of mine ask me to compile libevent PHP extension for Windows. it takes me about a whole day to figure out how to do that. just because it takes so much time I decided to publish how to do that. (To be honest we make it together .)
SOURCES
The following is a list of sources that we will need:
? PHP 5.3.6
? PECL libevent-0.0.4
? Libevent-2.0.11-stable
TOOLS
The following is a list of tools that we well need:
? Windows SDK for Windows Server 2008 and. NET Framework 3.5
? Php sdk Binary Tools
? PHP 5.3 Depencencies (for the minimal PHP they are not necessary)
1. INSTALL WINDOWS SDK
I assume that they will be installed into c: \ sdk directory.
2. create c: \ PHPSDK DIRECTORY
This is our workplace. I find it much easier to explain, read, and follow how to create it usingpseudo-code rather than words:
Mkdir c: \ phpsdk
Pushd c: \ phpsdk
Extract http://windows.php.net/downloads/php-sdk/php-sdk-binary-tools-20110512.zip
Bin \ phpsdk_setvars.bat
Bin \ phpsdk_buildtree.bat php-5.3.6
Pushd php-5.3.6 \ vc9 \ x86
Extract http://md.php.net/distributions/php-5.3.6.tar.bz2
Music php-5.3.6 src
Extract http://windows.php.net/downloads/php-sdk/deps-5.3-vc9-x86.7z
Popd

Extract http://pecl.php.net/get/libevent-0.0.4.tgz
Rm package. xml
Music libevent-0.0.4 php_libevent
Pushd php_libevent
Extract http://monkey.org /~ Provos/libevent-2.0.11-stable.tar.gz
Popd
Popd
3. COMPILE MINIMAL PHP
Cmd/e: on/v: on
C: \ sdk \ bin \ setenv. cmd/x86/xp/release
C: \ phpsdk \ bin \ phpsdk_setvars.bat
Cd c: \ phpsdk \ php-5.3.6 \ vc9 \ x86 \ src
Buildconf
Configure -- disable-all -- enable-cli
Nmake
Rem The following command creates php-5.3.6-devel-VC9-x86
Rem directory which gives us extension developer's header
Rem and. lib files
Nmake snap
4. COMPILE LIBEVENT-2.0.11-STABLE
Cmd/e: on/v: on
C: \ sdk \ bin \ setenv. cmd/x86/xp/release
C: \ phpsdk \ bin \ phpsdk_setvars.bat
Cd c: \ phpsdk \ php_libevent \ libevent-2.0.11-stable
Nmake-f Makefile. nmake
5. COMPILE PHP_LIBEVENT.DLL
This was the most trickier part.
Cmd/e: on/v: on
C: \ sdk \ bin \ setenv. cmd/x86/xp/release
C: \ phpsdk \ bin \ phpsdk_setvars.bat
Cd c: \ phpsdk \ php_libevent
Set phpdevdir = c: \ phpsdk \ php-5.3.6 \ vc9 \ x86 \ src \ Release_TS \ php-5.3.6-devel-VC9-x86
Set libeventdir = c: \ phpsdk \ libevent \ libevent-2.0.11-stable

Cl libevent. c ^
/C ^
/Fophp_libevent.obj ^
/DZEND_WIN32 ^
/DPHP_WIN32 ^
/DWIN32 ^
/DZTS = 1 ^
/DZEND_DEBUG = 0 ^
/DCOMPILE_DL_LIBEVENT ^
/I % phpdevdir % \ include \ Zend ^
/I % phpdevdir % \ include \ main ^
/I % phpdevdir % \ include \ TSRM ^
/I % phpdevdir % \ include ^
/I % libeventdir % \ WIN32-Code ^
/I % libeventdir % \ include ^
/I % libeventdir %

Link php_libevent.obj ^
/DLL ^
Php5ts. lib/LIBPATH: % phpdevdir % \ lib ^
Libevent. lib/LIBPATH: % libeventdir % ^
Ws2_32.lib
6. TESTING PHP_LIBEVENT.DLL
Cd c: \ phpsdk \ php-5.3.6 \ vc9 \ x86 \ src \ Release_TS \ php-5.3.6
Copy php. ini-development php. ini
Echo extension = c: \ phpsdk \ php_libevent \ php_libevent.dll> php. ini
Php-m
FILES
? Php-5.3.6-libevent-ts.zip
? Phpsdk-libevent-skeleton.zip (skeleton of our workspace directory)
REFERENCES
? Build your own PHP on Windows
? How do I compile an extension for PHP 5.3 for windows as a DLL?
? Creating a PHP 5 Extension with Visual C ++ 2005
? Creating a PHP Extension for Windows using Microsoft Visual C ++ 2008
? Compiling PHP for Windows Vista using Visual C ++ Express 2008-Seriously!

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.