Home > Backend Development > PHP Tutorial > How to develop and compile PHP extensions under windows vista home basic windows

How to develop and compile PHP extensions under windows vista home basic windows

WBOY
Release: 2016-07-29 08:44:39
Original
1079 people have browsed it

Now let’s briefly talk about the steps to develop PHP extensions under WINDOWS:
The software you need to prepare first is:
cygwin installation path e: appcygwin
visual studio C++ 6.0,
Modify the environment variables and set the installed PHP path as the environment variable. Here, assuming that my PHP installation directory is: e:appphp5.2.5, then I add this installation directory after the WINDOWS environment variable. It is convenient to use php.exe for a while.
PHP source code, here it is assumed to be e:c_source_codephp-5.2.5
1. Modify the file "PHP source file directory/ext/ext_skel_win32.php", here it is: E:c_source_codephp-5.2.5ext, the main thing is to modify it cygwin path. $cygwin_path = 'e:appcygwinbin';
Change $cygwin_path to the path where you actually installed cygwin.
2. In the source code ext directory, which is e:c_source_codephp-5.2.5ext, execute php ext_skel_win32.php --extname=. At this time, the directory will be generated in the ext directory. This directory is We are going to use the framework for PHP extension development. 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 php-rootdevphp5ts.lib to "ext/". For example, if the PHP extension you want to develop is foo, then you need to copy php-rootdevphp5ts.lib to the PHP source file directory extfoo.
4. Modify the content of foo.c and write the C code we need.
5. Enter the directory and open .dsp.
Set up the VC6 project,
Setting menu "Build" -> "Remove Project Configuration", select "Win 32 Release_TS",
Setting menu "Project", select "Win 32 Release_TS"
Open Tab "Connect", set " Directory in "Output File Name",
[Optional] Open Tab "C/C++", add "Preprocessor Definition" ",COMPILE_DL_" (note all capital letters, added by default), cancel the predefined "LIBZEND_EXPORTS" ” (otherwise the zend function cannot be introduced).
6. After setting up, compile and a dll file will be generated. The file name is .dll. For example, in our example, it is foo.dll.
Copy foo.dll to the e:appext directory. And add a line extension=foo.dll to php.ini, restart apache, check phpinfo();, you will find that our PHP extension foo() has been loaded, and you can use this foo extension.

The above introduces the method of developing and compiling PHP extensions under windows vista home basic windows, including the content of windows vista home basic. I hope it will be helpful to friends who are interested in PHP tutorials.

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