Home > Backend Development > PHP Tutorial > Detailed explanation of developing php extensions under Window7, detailed explanation of window7php extension_PHP tutorial

Detailed explanation of developing php extensions under Window7, detailed explanation of window7php extension_PHP tutorial

WBOY
Release: 2016-07-12 09:01:49
Original
968 people have browsed it

Detailed explanation of developing php extension under Window7, detailed explanation of window7php extension

1. First check the phpinfo() information

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

Thread safe, VC9 compiled, version 5.4.34

2. Preparation work before development

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

1. Unzip the files in php-sdk-binary-tools-20110915.zip and add the bin directory where bison.exe is located to the system path

Copy php-5.4.45-Win32-VC9-x86devphp5ts.lib to php-5.4.45-srcRelease_TSphp5ts.lib
Create a new php-5.4.45-srcmainconfig.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-srcextext_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 to
associate it with a program. chooses the CLI version of php.
*/
$cygwin_path = 'D:\Program Files\cygwin\bin'; 
Copy after login

Change this to your cygwin installation directory.

3. Run cmd, enter the php source code directory, php-5.4.45-srcext, and run the command php ext_skel_win32.php --extname=myphpexs


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

If successful, the myphpexs folder will be generated in the ext directory with the following content


4. Open myphpexs.dsp with vs2008, change the solution configuration to Release, and execute the generation command

If everything goes well, the php_myphpexs.dll file will be generated. I generated php_myphpexs.dll in the Release_TS folder of the php source code root directory

5. Place php_myphpexs.dll in your php extension directory, and add extension=php_myphpexs.dll to php.ini

6. Create a new php script file test.php with the following content

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

7. Run the test file and the following content will appear. Success

Copy code 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 volume function when creating an extension. When editing your own extension content, you can delete the modified function

Articles you may be interested in:

  • How to develop and compile PHP extensions under windows
  • Tutorial on installing PHP's imagick and imagemagick extensions under windows 7
  • Tutorial on installing php-ssh2 extension of php under windows 7
  • How to enable php curl extension in windows 2008 R2 64-bit server
  • Configuring php5.5 development environment and development extension under windows

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1087277.htmlTechArticleDetailed explanation of developing php extensions under Window7, detailed explanation of window7php extension 1. First check phpinfo() information PHP Version 5.4.34 Zend Extension Build API220100525,TS,VC9 PHP Extension Build API2010...
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template