Home >Backend Development >PHP Tutorial >MAC MAMP adds memcache extension
The PHP used on mamp is 5.5.26, etc. To compile the memcache module, you need to use the php source code. mamp does not come with it. Go to the php official website and download php-5.5.26.tar.gz.
After decompressing, generate zend_config.h Backup
tar -zxvf php-5.5.26.tar.gz cd php-<span>5.5</span>.<span><span>26</span></span><span> .</span>/configure
If an error is reported, you need to install dependencies according to the prompts. For example: zlib. Download it separately and decompress it in the same way. --prefix-dir=
Download and compile:
curl -O http:<span>//</span><span>pecl.php.net/get/memcache-2.2.4.tgz;</span><span>tar</span> xf memcache-<span>2.2</span>.<span>4</span><span>.tgz; cd memcache</span>-<span>2.2</span>.<span>4</span><span>; mkdir /<strong>Application</strong>s/MAMP/bin/php/php5.5.10/include/ </span>
<span># </span>/Volumes/SOFT/php-5.5.11 是 php 的目录
<span>ln -s /Volumes/SOFT/php-5.5.11 /<strong>Application</strong>s/MAMP/bin/php/php5.5.10/include/php </span>
/<strong>Application</strong>s/MAMP/bin/php/php5.<span>5.10</span>/bin/<span>phpize; .</span>/configure --with-php-c/MAMP/bin/php/php5.<span>5.10</span>/bin/php-<span>config </span><span>make</span><span>sudo</span><span>make</span><span>install</span>
If the prompt is as follows, it means that the system does not have autoconf and needs to be installed. After installation, re-execute phpize:
Cannot <span>find</span><span> autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable. Then, rerun this script.</span>
Install autoconf and install:
curl -O http:<span>//</span><span>ftp.gnu.org/gnu/autoconf/autoconf-2.68.tar.bz2;</span><span>tar</span> -xvf autoconf-<span>2.68</span>.<span>tar</span><span>.bz2 cd autoconf</span>-<span>2.68</span><span> .</span>/configure && <span>make</span><span>sudo</span><span>make</span><span>install</span>
The installation is now complete, click the mamp menu , file->edit template -> php -> php 5.5.10 php.ini , added:
<span>[memcache] extension</span>=memcache.so
The above introduces the memcache extension added to MAC MAMP, including the application content. I hope it will be helpful to friends who are interested in PHP tutorials.