Detailed description of developing php extensions under Window7, detailed description of window7php extension _ PHP Tutorial

Source: Internet
Author: User
Tags vc9
Detailed description: develop php extensions under Window7, and detailed description of window7php extensions. Detailed description of php extensions under Window7, detailed description of window7php extensions I. First, check the phpinfo () information PHPVersion5.4.34ZendExtensionBuildAPI220100525, TS, VC9PHPExtensionBuildAPI2010. detailed description of php extensions under Window7

1. first view the phpinfo () information

PHP Version 5.4.34
Zend Extension Build API220100525, TS, VC9
PHP Extension Build API20100525, TS, VC9
Thread Safety enable

Thread security, VC9 compilation, version 5.4.34

2. preparations before development

Php 5.3-5.4: Visual C ++ 9.0 (Visual Studio 2008)
Install Cygwin (: http://www.cygwin.com/), virtual linux environment
Php compiled program and pre-compiled source code (: http://windows.php.net/download)
The compiled program path: php-5.4.45-Win32-VC9-x86 \
Source code path before compilation: php-5.4.45-src \
Download php sdk, http://windows.php.net/downloads/php-sdk/

1. decompress the php-sdk-binary-tools-20151115.zipfile to add the system path to the bin directory of bison.exe.Medium

Copy php-5.4.45-Win32-VC9-x86 \ dev \ php5ts. lib to php-5.4.45-src \ Release_TS \ php5ts. lib
Create a 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 the php source code directory, php-5.4.45-src \ ext \ ext_skel_win32.php

/*This script can be used on Win systems) Make sure you have CygWin installed) Adjust the $cygwin_path to match your installation) Change the environment cariable PATHEXT to include .PHP) run ext_skel --extname=...the first time you run this script you will be asked toassociate it with a program. chooses the CLI version of php.*/$cygwin_path = 'D:\Program Files\cygwin\bin'; 

Change it to your cygwin installation directory.

3, run cmd, enter the php source code directory, php-5.4.45-src \ ext, run the command php ext_skel_win32.php -- extname = myphpexs


Remember to add the directory of php.exe to path, -- extname = your extension name,

If successful, the myphpexs folder will be generated in the ext Directory. the content is as follows:


4. use vs2008 to open myphpexs. dsp, change the solution configuration to Release, and run the generated command.

If it succeeds, the php_myphpexs.dll file will be generated. my php_myphpexs.dll will be generated again in the Release_TS folder of the php source code root directory.

5. put php_myphpexs.dll to your php extension directory, and then add extension = php_myphpexs.dll to php. ini.

6. create the php script file test. php. the content is as follows:

The code is as follows:
Echo confirm_myphpexs_compiled ('test ');

7. run the test file and the following content is displayed.

The code is as follows:
Congratulations! You have successfully modified ext/myphpext/config. m4. Module 23 is now compiled into PHP.

8. confirm_myphpexs_compiled is a built-in number function for creating extensions. you can delete and modify functions when editing your own extensions.

Articles you may be interested in:
  • Develop and compile PHP extensions in windows
  • How to install the imagick and imagemagick extensions of php in Windows 7
  • Windows 7 install php php-ssh2 extension tutorial
  • How to enable php curl extension on windows 2008 R2 64-bit server
  • Configure php5.5 development environment and development extension in windows

Develop the php Extension under the Extension. For more information, see window7php Extension 1. first view the phpinfo () information PHP Version 5.4.34 Zend Extension Build API220100525, TS, VC9 PHP Extension Build api2010...

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.