PHP 7 compiled Memcache extensions

Source: Internet
Author: User
Tags spl php source code sapi sqlite

1.1 Php-memcache (for PHP 7.x) 1.1.1 Overview

After PHP 7 comes out, Http://pecl.php.net/package/memcache does not have a for PHP7 version of the Php-memcache, need to compile one yourself. Found on the internet mostly under Linux, and I need to be under the Windows version, looking for a long time no and did not find the right version, had to do their own.

Note: This article is about compiling php-memcache, not memcached.

1.1.2 Download File

The following files need to be downloaded before compiling:

1, the compilation environment:

PHP 7 is compiled with VC14, so compiling php-memcached also needs to use VC14, because it is not commonly used VC14, so go to Microsoft's official website to download the trial version of Visual Studio Entrpise.

2. PHP Source code:

Download source code from PHP official website, address: http://windows.php.net/downloads/releases/php-7.0.6-src.zip

3. Download PHP-SDK file:

Address: http://windows.php.net/downloads/php-sdk/

There are two files to download here:

650) this.width=650; "height=" 209 "src=" Http://static.oschina.net/uploads/space/2016/0513/081559_vdKq_2704746.png "Width=" 340 "/>

4, download the memcache extension package source:

Address: Https://github.com/websupport-sk/pecl-memcache

PHP Memcache official website has not been updated for n years, the above URL is github on the support of PHP 7 branch code.

1.1.3 Compiling

1. Create a directory for compiling: D:\PHPCompile;

2, decompression php-sdk-binary-tools-20110915.zip inside the file into the Phpcompile directory;

3, editor “d:\phpcompile\bin\phpsdk_buildtree.bat”, in “ GOTO exit” before adding code:

MD%_%\vc14\x86\deps\bin

MD%_%\vc14\x86\deps\lib

MD%_%\vc14\x86\deps\include

MD%_%\vc14\x64\deps\bin

MD%_%\vc14\x64\deps\lib

MD%_%\vc14\x64\deps\include

Note: This is because Phpsdk_buildtree.bat is old and does not support VC14, so it needs to be modified.

4. Find and Open in the Start menu “ VS2015 x64 Native Tools command Prompt ” (note: If you want to compile 32-bit, go to the VS2015 x86 native tools command Prompt), go to the D:\PHPCompile directory, and then execute the following command:

Bin\phpsdk_setvars.bat

Bin\phpsdk_buildtree.bat Phpdev

5, after the execution, the directory will generate Phpdev folder;

6, enter D:\PHPCompile\phpdev\vc14\x64\, extract deps-7.0-vc14-x64.7z to this directory, overwrite Deps folder

7, the PHP source code is also extracted to the x64 directory, the extracted directory name to PHP7;

8, in the x64 directory to create the Pecl folder, under the folder to establish Memcache folder, the download Php7-memcache code extracted to this directory, the final directory structure is as follows:

650) this.width=650; "height=" 265 "src=" http://static.oschina.net/uploads/space/2016/0513/081809_6RmS_2704746.png "Width=" 410 "/>

9. Execute the following command to create a PHP compilation configuration:

CD PHPDEV\VC14\X64\PHP7

Buildconf

Configure--help, ... \configure_help.txt

Configure--disable-all--enable-cli--enable-zlib--enable-hash--enable-session--without-gd--with-bz2-- Enable-memcache=shared--enable-object-out-dir=. \obj

Note:--enable-memcache=shared in the configuration means that Memcache is generated as a DLL, otherwise it is integrated with PHP.

If the hint Bison.exe does not exist, execute the following command, and then re-perform the above operation:

Set path=%path%;D: \phpcompile\bin

10, after the successful execution of the Configure command, it is best to check the following parameters before the actual start of the compilation:

Snapshot:forcing one-shot on

Snapshot:forcing Debug-pack on

Snapshot:forcing--disable-security-flags GKFX

Snapshot:forcing Analyzer on

Snapshot:forcing--without-uncritical-warn-choke GKFX

Snapshot:forcing Codegen-arch on

Snapshot:forcing Apache2handler on

Snapshot:forcing Apache2-2handler on

Snapshot:forcing Apache2-4handler on

Snapshot:forcing Cli-win32 on

Snapshot:forcing embed on

Snapshot:forcing phpdbg on

Snapshot:forcing PHPDBGS on

Snapshot:forcing--disable-phpdbg-webhelper GKFX

Snapshot:forcing bz2 on

Snapshot:forcing Curl on

Snapshot:forcing DBA on

Snapshot:forcing enchant on

Snapshot:forcing FileInfo on

snapshot:forcing FTP on

Snapshot:forcing--WITHOUT-LIBWEBP GKFX

Snapshot:forcing GetText on

Snapshot:forcing GMP on

Snapshot:forcing Mhash on

Snapshot:forcing IMAP ON

Snapshot:forcing InterBase on

Snapshot:forcing Intl On

Snapshot:forcing LDAP on

Snapshot:forcing LIBMBFL on

Snapshot:forcing mbstring on

Snapshot:forcing Mbregex on

Snapshot:forcing--disable-mbregex-backtrack GKFX

Snapshot:forcing MCrypt on

Snapshot:forcing Oci8 on

Snapshot:forcing oci8-11g on

Snapshot:forcing oci8-12c on

Snapshot:forcing ODBC on

Snapshot:forcing--disable-opcache-file GKFX

Snapshot:forcing OpenSSL on

Snapshot:forcing Pgsql on

Snapshot:forcing Pspell on

Snapshot:forcing Shmop on

Snapshot:forcing SNMP on

Snapshot:forcing sockets on

Snapshot:forcing Sqlite3 on

Snapshot:forcing Sysvshm on

Snapshot:forcing Tidy on

Snapshot:forcing EXIF on

Snapshot:forcing mysqli on

Snapshot:forcing PDO on

Snapshot:forcing Pdo-dblib on

Snapshot:forcing Pdo-mssql on

Snapshot:forcing Pdo-firebird on

Snapshot:forcing Pdo-mysql on

Snapshot:forcing Pdo-oci on

Snapshot:forcing Pdo-odbc on

Snapshot:forcing Pdo-pgsql on

Snapshot:forcing Pdo-sqlite on

Snapshot:forcing pdo-sqlite-external on

Snapshot:forcing Phar-native-ssl on

snapshot:forcing soap On

Snapshot:forcing Xmlrpc on

Snapshot:forcing XSL on

Saving Configure options to Config.nice.bat

Checking for Cl.exe ...

Detected compiler MSVC14 (Visual C + + 2015)

Detected 64-bit compiler

Checking for Link.exe ... C:\Program Files (x86) \microsoft Visual Studio 14.0\vc\bin\amd64

Checking for Nmake.exe ...

Checking for Lib.exe ...

Checking for Bison.exe ...

Checking for Re2c.exe ...

Detected RE2C version 0.13.5

Checking for Zip.exe ...

Checking for Lemon.exe ...

Checking for Mc.exe ... C:\Program Files (x86) \ Windows kits\8.1\bin\x64

Checking for Mt.exe ... C:\Program Files (x86) \ Windows kits\8.1\bin\x64

Enabling Multi Process Build

Build Dir:d:\phpcompile\phpdev\vc14\x64\obj\release_ts

PHP Core:php7ts.dll and Php7ts.lib

Checking for wspiapi.h ...

Enabling IPV6 Support

Enabling SAPI sapi\cgi

Enabling SAPI Sapi\cli

Enabling extension ext\date

Enabling extension Ext\pcre

Enabling extension ext\reflection

Enabling extension ext\session

Enabling extension EXT\SPL

Checking for timelib_config.h ... ext/date/lib

Enabling extension Ext\standard

enabling extension. \pecl\memcache [Shared]

Creating Build dirs ...

Generating files ...

Generating Makefile

Generating MAIN/INTERNAL_FUNCTIONS.C

[content unchanged; skipping]

Generating Main/config.w32.h

Generating Phpize

Done.

Enabled Extensions:

-----------------------

| Extension | Mode |

-----------------------

| Date | static |

| Memcache | Shared |

| Pcre | static |

| Reflection | static |

| Session | static |

| SPL | static |

| Standard | static |

-----------------------

Enabled SAPI:

-------------

| Sapi Name |

-------------

| CGI |

| CLI |

-------------

----------------------------------------------

|                          | |

----------------------------------------------

| Build Type | Release |

| Thread Safety | Yes |

| Compiler | MSVC14 (Visual C + + 2015) |

| Architecture | x64 |

| optimization | PGO Disabled |

| Static Analyzer | Disabled |

----------------------------------------------

Type ' NMAKE snap ' to build a PHP snapshot

D:\phpcompile\phpdev\vc14\x64\php7>

11, the execution of NMAKE command, wait more than 10 minutes, if no problem will be compiled successfully, if there is a problem, hehe, it will be based on the error information a little troubleshooting;

12, after the successful compilation, can be found in the “D:\PHPCompile\phpdev\vc14\x64\obj\Release_TS\” directory Php_memcache.dll;

1.1.4 Installation

Installation is simple, unzip the php_memcache.dll into the PHP ext directory.

1.1.5 Configuration

Open PHP.ini, another line in a bunch of extension configuration items, enter:

Extension=php_memcache.dll

1.1.6 Verification

After restarting the Apache server, open http://localhost/phpinfo.php in the browser, search for memcache, see the following to show that the installation was successful:

650) this.width=650; "height=" 133 "src=" http://static.oschina.net/uploads/space/2016/0513/081903_QGCh_2704746.png "Width=" 957 "/>

1.1.7 Reference Documents

Https://wiki.php.net/internals/windows/stepbystepbuild#building_pecl_extensions

http://blog.csdn.net/mycwq/article/details/10165955

https://bugs.php.net/bug.php?id=70751

This article is from the "Rainman" blog, make sure to keep this source http://lancelot.blog.51cto.com/393579/1772931

Compiling memcache extensions under PHP 7

Related Article

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.