Window7 下开发php扩展,window7开发php扩展
Window7 下开发php扩展,window7开发php扩展
一、首先查看phpinfo() 信息
PHP Version 5.4.34
Zend Extension Build API220100525,TS,VC9
PHP Extension Build API20100525,TS,VC9
Thread Safety enable
线程安全,VC9编译,5.4.34版本
二、开发前准备工作
php 5.3-5.4 :Visual C++ 9.0(Visual Studio 2008)
安装Cygwin(下载地址:http://www.cygwin.com/),虚拟linux环境
php编译后的程序和编译前的源码(下载地址:http://windows.php.net/download/)
编译后的程序路径:php-5.4.45-Win32-VC9-x86\
编译前的源码路径:php-5.4.45-src\
下载php sdk文件,http://windows.php.net/downloads/php-sdk/
1、解压php-sdk-binary-tools-20110915.zip里面的文件,将bison.exe所在的bin目录添加的系统path中
将php-5.4.45-Win32-VC9-x86\dev\php5ts.lib 复制到php-5.4.45-src\Release_TS\php5ts.lib
新建php-5.4.45-src\main\config.win32.h,内容如下:
#define SIZEOF_LONG 4
#define PHP_COMPILER_ID "VC9"
"VC9"对应VC9
2、找到php源码目录, php-5.4.45-src\ext\ext_skel_win32.php
<span> 1</span> <span>/*</span> <span> 2</span> <span> This script can be used on Win32 systems </span><span> 3</span> <span> 4</span> <span> 1) Make sure you have CygWin installed </span><span> 5</span> <span> 2) Adjust the $cygwin_path to match your installation </span><span> 6</span> <span> 3) Change the environment cariable PATHEXT to include .PHP </span><span> 7</span> <span> 4) run ext_skel --extname=... </span><span> 8</span> <span> the first time you run this script you will be asked to </span><span> 9</span> <span> associate it with a program. chooses the CLI version of php. </span><span>10</span> <span>*/</span> <span>11</span> <span>$cygwin_path</span> = 'D:\Program Files\cygwin\bin';
这里改成你的cygwin安装目录。
3、运行cmd,进入php源码目录, php-5.4.45-src\ext,运行命令php ext_skel_win32.php --extname=myphpexs
记得将php.exe 所在目录加入path,--extname=你的扩展名字,
若成功会再ext目录下生成myphpexs文件夹,内容如下
4、用vs2008 打开myphpexs.dsp, 解决方案配置改为Release,执行生成命令
顺利的话将生成php_myphpexs.dll文件,我的将php_myphpexs.dll生成再了php源码根目录的Release_TS文件夹中
5、将php_myphpexs.dll放到你php的扩展目录,再php.ini中加上extension=php_myphpexs.dll
6、新建php脚本文件test.php,内容如下
<span>1</span> <span>echo</span> confirm_myphpexs_compiled('test');
7、运行测试文件,出现如下内容说明,成功了
Congratulations! You have successfully modified ext/myphpext/config.m4. Module 23 is now compiled into PHP.
8、confirm_myphpexs_compiled是建立扩展是自带的册数函数,在编辑你自己的扩展内容时,可以删除改函数

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Both curl and Pythonrequests are powerful tools for sending HTTP requests. While curl is a command-line tool that allows you to send requests directly from the terminal, Python's requests library provides a more programmatic way to send requests from Python code. The basic syntax for converting curl to Pythonrequestscurl command is as follows: curl[OPTIONS]URL When converting curl command to Python request, we need to convert the options and URL into Python code. Here is an example curlPOST command: curl-XPOST https://example.com/api

To update the curl version under Linux, you can follow the steps below: Check the current curl version: First, you need to determine the curl version installed in the current system. Open a terminal and execute the following command: curl --version This command will display the current curl version information. Confirm available curl version: Before updating curl, you need to confirm the latest version available. You can visit curl's official website (curl.haxx.se) or related software sources to find the latest version of curl. Download the curl source code: Using curl or a browser, download the source code file for the curl version of your choice (usually .tar.gz or .tar.bz2

PHP8.1 released: Introducing curl for concurrent processing of multiple requests. Recently, PHP officially released the latest version of PHP8.1, which introduced an important feature: curl for concurrent processing of multiple requests. This new feature provides developers with a more efficient and flexible way to handle multiple HTTP requests, greatly improving performance and user experience. In previous versions, handling multiple requests often required creating multiple curl resources and using loops to send and receive data respectively. Although this method can achieve the purpose

From start to finish: How to use php extension cURL for HTTP requests Introduction: In web development, it is often necessary to communicate with third-party APIs or other remote servers. Using cURL to make HTTP requests is a common and powerful way. This article will introduce how to use PHP to extend cURL to perform HTTP requests, and provide some practical code examples. 1. Preparation First, make sure that php has the cURL extension installed. You can execute php-m|grepcurl on the command line to check

In Linux, curl is a very practical tool for transferring data to and from the server. It is a file transfer tool that uses URL rules to work under the command line; it supports file upload and download, and is a comprehensive transfer tool. . Curl provides a lot of very useful functions, including proxy access, user authentication, ftp upload and download, HTTP POST, SSL connection, cookie support, breakpoint resume and so on.

How to handle 301 redirection of web pages in PHPCurl? When using PHPCurl to send network requests, you will often encounter a 301 status code returned by the web page, indicating that the page has been permanently redirected. In order to handle this situation correctly, we need to add some specific options and processing logic to the Curl request. The following will introduce in detail how to handle 301 redirection of web pages in PHPCurl, and provide specific code examples. 301 redirect processing principle 301 redirect means that the server returns a 30

How to set cookies in php curl: 1. Create a PHP sample file; 2. Set cURL transmission options through the "curl_setopt" function; 3. Pass the cookie in CURL.

PHP is a widely used open source scripting language used by many websites. However, sometimes you may encounter the problem PHPFatalerror:Calltoundefinedfunctioncurl_setopt(), which may prevent your website from working properly. So what exactly causes this problem? In PHP, curl_setopt() is a very important function, which is used to extend the library through curl
