MAC安裝PHP擴充之MEMCACHE的例子

來源:互聯網
上載者:User

在執行phpize的時候,出現錯誤提示
grep: /usr/include/php/main/php.h: No such file or directory
grep: /usr/include/php/Zend/zend_modules.h: No such file or directory
grep: /usr/include/php/Zend/zend_extensions.h: No such file or directory
Configuring for:
PHP Api Version:
Zend Module Api No:
Zend Extension Api No:
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
1.由於/usr/include目錄不存在,所以需要執行命令
sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/ /usr/include
2.系統沒有安裝autoconf所以需要安裝之,此項可參考http://blog.wwllcchf.com/?p=260
安裝php擴充還可以按照以下方法
為了擴充管理方便,首先來安裝pecl擴充管理器:
cd /usr/lib/php
sudo php install-pear-nozlib.phar
安裝Redis、Memcache、Mongo等擴充。
sudo pecl install redis
sudo pecl install memcache
sudo pecl install mongo
sudo pecl install xdebug
將擴充配置添加的php.ini檔案中:
extension=memcache.so
extension=mongo.so
extension=redis.so
zend_extension=xdebug.so
安裝xcache,從官網下載Release-3.2.0解壓縮並安裝
tar xvf xcache-3.2.0.tar
cd xcache-3.2.0
phpize
/configure
make
sudo make install
配置XCache
[xcache]
xcache.size = 128M
xcache.var_size = 8M
xcache.var_count = 1
xcache.var_slots = 8K
xcache.var_ttl = 0
xcache.var_maxttl = 0
xcache.var_gc_interval = 300
xcache.optimizer = Off
由於Mac內建的PHP環境是不包括mcrypt擴充的,所以需要下載同版本的php源碼包,單獨編譯這個模組載入。從官網的歸檔裡面找到php5.5.14的源碼包,下載:http://php.net/releases/
tar zxvf php-5.5.14.tar.gz
cd php-5.5.14/ext/mcrypt/
phpize
。/configure
make
sudo make install
配置ext-mcrypt
extension=mcrypt.so
為了加速,還需要開啟opcache。
zend_extension=opcache.so
[opcache]
; Determines if Zend OPCache is enabled
opcache.enable=0
; Determines if Zend OPCache is enabled for the CLI version of PHP
opcache.enable_cli=0

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.