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=
3. Copy php-rootdevphp5ts.lib to "ext/
4. Modify the content of foo.c and write the C code we need.
5. Enter the
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_
6. After setting up, compile and a dll file will be generated. The file name is
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.