Remember to manually install pecl extension-memcache

Source: Internet
Author: User
Tags zts

Download zlib (because php's memcache extension module uses the function» zlib to support data compression, Zlib must be installed to install this module. ): Http://sourceforge.net/projects/libpng/files/zlib/1.2.5/zlib-1.2.5.tar.gz/download

Download memcache php extensions: http://pecl.php.net/get/memcache-3.0.6.tgz

Zlib is not installed by default in Ubuntu11.04. Therefore, you must first install zlib.

 

Tar-xzvf zlib-1.2.5.tar.gz
Cd zlib-1.2.5
./Configure -- prefix =/usr/dev/zlib
Make
Make installl

 

 

Then install memcache

 

Tar-xzvf memcache-3.0.6.tgz
Cd memcache-3.0.6
/Usr/dev/php-5.3.6/bin/phpize // use phpize to generate the configure file, phpize is compiled by pecl, phpize is generally in the bin directory of the php installation directory, you can refer to here: http://www.cnblogs.com/wangtao_20/archive/2011/3/16.html
In this step, the following error may be reported: Cannot find autoconf. Please check your autoconf installation
This is because autoconf has not been installed or the autoconf settings in phpize are incorrect. First, use dpkg-l to check whether autoconf has been installed. If autoconf is not installed, download and install it:
Download autoconf http://ftp.gnu.org/gnu/autoconf/autoconf-2.68.tar.gz
Tar-xzvf autoconf-2.68.tar.gz
Cd autoconf-2.68
./Configure -- prefix =/usr/dev/pecl/autoconf
Make
Make install after installation is successful, you need to change the phpsize
Sudo gedit/usr/dev/php-5.3.6/bin/phpize
Find test-z "$ PHP_AUTOCONF" and test-z "$ PHP_AUTOHEADER", as shown in the following example:
Test-z "$ PHP_AUTOCONF" & PHP_AUTOCONF = autoconf
Test-z "$ PHP_AUTOHEADER" & PHP_AUTOHEADER = autoheader
Changed:
Test-z "$ PHP_AUTOCONF" & PHP_AUTOCONF =/usr/dev/pecl/autoconf/bin/autoconf
Test-z "$ PHP_AUTOHEADER" & PHP_AUTOHEADER =/usr/dev/pecl/autoconf/bin/autoheader
Save and exit
Back to memcache-3.0.6 directory

/Usr/dev/php-5.3.6/bin/phpize // execution successful, a configure file is generated in the current directory
. // Configure -- with-php-config =/usr/dev/php-5.3.6/bin/php-config -- with-zlib-dir =/usr/dev/zlib -- with-apxs =/ usr/dev/apache/bin/apxs -- with-gettext -- enable-socket -- enable-memcache -- enable-sysvshm -- enable-shmop
Make
Make install

 

 

Open the php. ini file, in this example/usr/dev/php-5.3.6/lib/php. ini

Add the following two rows:

Extension_dir =/usr/dev/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626 "extension = memcache. so

 

Of course, you can also

/Usr/dev/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/memcache. so to/usr/dev/php5.3.6/lib/php/extensions/memcache. so or create a pointer to/usr/dev/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/memcache. so hard link/usr/dev/php5.3.6/lib/php/extensions/memcache. so

 

 

Then add the following two lines to php. ini:

Extension_dir =/usr/dev/php5.3.6/lib/php/extensions "extension = memcache. so

Disable saving php. ini, restart apache, and use memcache extension in php code.

 

 

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.