Windows compile and install PHP extensions eaccelerator Tutorial _win server

Source: Internet
Author: User
Tags install php php code vc9 win32

Eaccelerator is an open source PHP Accelerator for optimizing programs, encoders, and dynamic content caching. It caches PHP scripts in a compiled state to improve their performance, so those system overhead can be almost eliminated at compile time. It is also able to optimize scripts to speed up their execution. Using Eaccelerator can reduce server load and improve the efficiency of PHP code execution.

First, preliminary preparation

1. Download PHP original code and binary package
Address: http://windows.php.net/download/
2, download eaccelerator (select Zip package)
Address: http://eaccelerator.net/
3. PHP configuration file Config.w32.h
Address: Http://xiazai.jb51.net/201501/other/php_w32_config.rar

Ps:

1, download the binary package and configuration files, mainly in order to save the process of compiling PHP
2, PHP in the win under the Vc9, VC6, and other versions, before downloading to select, compiled extensions can only be used for the corresponding version of PHP
3, If selected VC6,VC11, you want to modify the corresponding VC information in Config.w32.h

Second, decompression process (this case selected VC9)

1, direct decompression php-5.3.26-src.zip,eaccelerator.zip to D:\
2, copy config.w32.h to D:\php-5.3.26-src\main directory
3, decompression php-5.3.26-win32-vc9-x86.zip need to extract to the d:\php directory
4. Copy the D:\php\dev\php5ts.lib to the Eaccelerator folder
5, the Eaccelerator folder cut to D:\php-5.3.26-src\ext

III. compilation process (errors may be related to eaccelerator version)

1. Open Eaccelerator Project. \win32\eaccelerator.sln, set to Win32 release.
2, configuration Item properties: link library-General, additional Library directory Supplement ". \ ...";
3. To start compiling the project, the following error may occur:

Copy Code code as follows:

.. /.. /.. /main\streams/php_stream_transport.h (): Error c2143:syntax error:missing ') ' before ' *

.. /.. /.. /main\streams/php_stream_transport.h: Error C2081: ' socklen_t ': name in formal parameter list illegal

Workaround: This is due to the error of not finding the macro report. Open this file and add a typedef int socklen_t;

4. To continue compiling, the following error may occur:

Copy Code code as follows:

\EXT\EACCELERATOR\EA_STORE.C (205): Error c2143:syntax error:missing '; ' Before ' type '

\EXT\EACCELERATOR\EA_STORE.C (207): Error C2065: ' Opline ': undeclared identifier


Solution: This is because the project does not use the standard C writing, the "Zend_op *opline, *end;" Move to "addsize (size, from->last * sizeof (ZEND_OP));" Above, which is the header in the IF structure.

5, continue to compile, there should be no other errors, completed in the release directory to find Eaccelerator_ts.dll

Iv. concluding remarks

1, write this article, not only shows how to compile eaccelerator in Windows, but also explained that under Windows can directly write PHP extensions, without the help of Cygwin and so on

2, PHP version control is not very ideal, it is also difficult to avoid the estimate. 4.0 and 5.0 or 5.3 are very different, and the same version there are compiler differences, thread safety differences, so development should also pay attention to this problem.

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.