如何在Mac OS X中安装PHP扩展支持
时间:2023-06-21 05:52:07
Linux系统中有着许多PHP扩展,不过都需要用户们手动安装后才可以使用,一些MAC OS X用户想在自己的电脑上安装和使用这些PHP扩展,那么该怎么进行安装呢?下面就和小编一起来看看具体的安装步骤吧。
安装方法:
安装PHP扩展要求你的Mac系统已经安装了Xcode环境和命令行开发工具,如果还没安装,请先使用Shell安装。
xcode-select --install
为了扩展管理方便,首先来安装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,从官网下载https://xcache.lighttpd.net/wiki/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的源码包,下载:https://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
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Win10 PC系统地图定位不准的原因以及解决办法
![](https://img.aspxhome.com/file/2023/28/a247461_0s.jpg)
魔兽世界大脚游戏路径怎么设置_魔兽世界大脚游戏路径设置的步骤
![](https://img.aspxhome.com/file/2023/3/a293973_0s.png)
中通宝盒pc端怎么使用 中通宝盒简单的使用方法及常见问题分享
![](https://img.aspxhome.com/file/2023/4/14974_0s.jpg)
Excel中表格加密设置密码的操作方法
word提示“Microsoft Office Word已停止工作”终极解决方法步骤
![](https://img.aspxhome.com/file/2023/9/29729_0s.jpg)
Excel怎么制作文件访问路径
![](https://img.aspxhome.com/file/2023/3/35973_0s.jpg)
win10系统怎么安装正式版视频安装教程
excel中怎么画香蕉的简笔画?
![](https://img.aspxhome.com/file/2023/5/41355_0s.jpg)
jpg照片太大怎么压缩变小?Photo Size Changer三步搞定你的烦恼~
![](https://img.aspxhome.com/file/2023/5/a209675_0s.jpeg)
win10录音设备在哪里设置
![](https://img.aspxhome.com/file/2023/1/a282514_0s.jpg)
你的 Apple ID 仍在用不安全的第三方邮箱吗?Apple ID 邮箱修改教程
![](https://img.aspxhome.com/file/2023/7/a199627_0s.jpg)
WPS 如何同时给excel三个工作簿添加内容
![](https://img.aspxhome.com/file/2023/4/a185144_0s.png)
U盘安装Ghost版win7系统教程_U盘安装Ghost版win7系统步骤教程
![](https://img.aspxhome.com/file/2023/5/a317198_0s.png)
excel2003文件保存、另存为及自动保存的操作方法
![](https://img.aspxhome.com/file/2023/5/a140455_0s.jpg)
如何删除开始菜单中的msresourceappnametext快捷方式?
![](https://img.aspxhome.com/file/2023/25/a217142_0s.jpg)
win10中Windows Defender 怎样打开?
![](https://img.aspxhome.com/file/2023/28/a248216_0s.jpg)
未知错误3004怎么办-未知错误3004解决方法
![](https://img.aspxhome.com/file/2023/3/a299851_0s.jpg)
iOS 13 测试版中音量框发生了哪些变化?静音开关有变化吗?
![](https://img.aspxhome.com/file/2023/1/a197631_0s.gif)
Win10硬盘提示“Ultra DMA CRC错误计数”解决方法
![](https://img.aspxhome.com/file/2023/1/a279758_0s.png)
电脑重装系统失败怎么办?系统之家装机大师重装失败的解决方法
![](https://img.aspxhome.com/file/2023/1/a275186_0s.png)