PHP Extensions Develop Windows configuration

Source: Internet
Author: User

1. Download PHP5.4.27 Source code

2. Download php-5.4.27-win32-vc9-x86

3. Put them in the same directory, such as the Php_win_ext directory

4. Copy the src/win32/build/config.w32.h.in file from source to src/main/, and rename it as: Config.w32.h.

5. Create the WIN32 DLL project and empty the project. Remember to attach the LIB to the project, include the directory, some macro definitions (ZEND WIN32 must be php_win32 zend_win32, etc., specifically refer to the ZEND development documentation).

6. In the source code, you need to specify the version number of the compilation: #define PHP_COMPILER_ID "VC9"

Note: You need to download the thread-safe version of PHP because the plugin I'm developing is the WIN32 interface engine, which requires thread safety.

5.4 Using VC9, also known as VS2008, can be created manually without creating skeleton code.

Below the online copy of a code, I compiled, normal display

/** * Sample code **/#definephp_compiler_id "VC9"#include"Php.h"#include"ext/standard/info.h"Zend_function (example); Php_minfo_function (example); Zend_function_entry use_functions[]={Zend_fe (example, null) {NULL, NULL, NULL}}; Zend_module_entry example_module_entry={standard_module_header,"PHP Extension Example", use_functions, NULL, NULL, NULL, NULL, Php_minfo (example),"1.0 Beta", standard_module_properties}; Zend_get_module (example); Zend_function (example) {BOOLparam; if(Zend_parse_parameters (Zend_num_args () TSRMLS_CC,"|b", &param) = =FAILURE)         {e_error; return; }      if(param) {php_printf ("Example Parm is true"); } Else{php_printf ("Example Parm is False"); }      return;}    Php_minfo_function (example) {Php_info_print_table_start (); Php_info_print_table_header (2,"PHP Extension Example Support","enabled"); Php_info_print_table_row (2,"Version","1.0 Beta"); Php_info_print_table_end ();}
<?  Echo Example (true); // output: Example Parm is true ?>

Remember that in the php.ini add this plugin, after the successful compilation, that is, the introduction has been introduced, you can slowly add other function extension functions.

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.