Methods for developing and compiling PHP extensions under Windows Vista Home Basic windows

Source: Internet
Author: User
Tags php source code
Now let's just say a few steps to developing a PHP extension under Windows:
The first software to be prepared is:
Cygwin installation path E:\app\cygwin
Visual Studio C + + 6.0,
Modify the environment variable and set the installed PHP path to the environment variable. Here, assuming that my PHP installation directory is: e:\app\php5.2.5, then I add the Windows environment variable after the installation directory. Easy to use Php.exe for a while.
PHP source code, this is assumed to be e:\c_source_code\php-5.2.5
1, modify the file "php source file directory/ext/ext_skel_win32.php", here is: E:\c_source_code\php-5.2.5\ext, which is mainly to modify the Cygwin path. $cygwin _path = ' e:\app\cygwin\bin ';
Change the $cygwin_path to the path where you actually installed the Cygwin.
2, in the source code ext directory is E:\c_source_code\php-5.2.5\ext, execute PHP ext_skel_win32.php--extname= , it will be generated in the EXT directory at this time directory, which is the framework in which we will develop PHP extensions. For example, if you run Php.exe ext_skel_win32.php--extname=foo, the Foo directory will be generated in the EXT directory.
3. Copy the Php-root\dev\php5ts.lib to "ext/ "in. For example, if you are developing a php extension called Foo, you will need to copy the Php-root\dev\php5ts.lib to the PHP source file directory \ext\foo.
4, modify the foo.c content, write the C code we need.
5, go to directory, open . DSP.
Set VC6 Project,
set menu "Build", "Remove Project Configuration", select "Win + release_ts",
Set Menu "Project", select "Win Release_ts"
Open tab "Connect" , set the directory in output file name,
[optional] to open tab "C + +", add "preprocessor definition", "Compile_dl_ " (Note all uppercase, default), cancel the predefined "Libzend_exports" (No The Zend function cannot be introduced).
6, set up, compile, generate a DLL file, the file name is . dll, for example, in our example for Foo.dll
to copy Foo.dll to E:\app\ext directory, and in php.ini Riga Last line Extension=foo.dll, reboot Apache, view Phpinfo (), and we will find that our PHP extension foo () has been loaded and can already be extended using this foo.

The above describes how to develop and compile PHP extensions under Windows Vista Home Basic windows, including the content of Windows Vista Home Basic, and hopefully help friends who are interested in PHP tutorials.

  • Related Article

    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.