php重新编译,mac 系统重新编译php

本文介绍如何在Mac环境下配置PHP环境,包括通过第三方库安装PHP并解决编译问题的方法,如增加GD库FreeType支持的具体步骤。

mac 下的php环境,要不是自带编译好的,要不就是第三方的库

类似操作:curl -s http://php-osx.liip.ch/install.sh | bash -s 7.2

第三方库有个小问题就是重新编译比较麻烦,例如需要重新添加memcache memcached 等

但是偶尔还需要自行编译时(例如增加PHP支持GD库FreeType)操作流程可以参考如下方法:

1、打开本地的phpinfo如下图示,得到php的版本号,去下载对应的源码,解包到本地;

2、在phpinfo界面的顶部,查看原始编译命令【configure command】,复制出来

291df984cbad?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

WX20190502-092124@2x.png

原始编译命令(替换掉单引号'之后的字符串)

./configure --prefix=/usr/local/php/7.2 --with-config-file-path=/usr/local/etc/php/7.2 --with-config-file-scan-dir=/usr/local/etc/php/7.2/conf.d --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysqli --with-pdo-mysql --with-iconv-dir=/usr/local --enable-short-tags --with-zlib --with-libxml-dir=/usr/bin/xml2-config --enable-xml --disable-rpath --enable-bcmath --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --with-mcrypt-dir=/usr/local/Cellar/mcrypt/2.6.8/ --with-gd --with-openssl=/usr/local/opt/openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --disable-fileinfo --enable-maintainer-zts --enable-mysqlnd

3、brew install freetype

brew 安装的位置,默认为/usr/local/Cellar/...

然后得到类似路径: /usr/local/Cellar/freetype/2.9.1/

4、重新编译php(其实就是在第二点增加参数 --with-freetype-dir=...)

./configure --prefix=/usr/local/php/7.2 --with-config-file-path=/usr/local/etc/php/7.2 --with-config-file-scan-dir=/usr/local/etc/php/7.2/conf.d --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysqli --with-pdo-mysql --with-iconv-dir=/usr/local --enable-short-tags --with-zlib --with-libxml-dir=/usr/bin/xml2-config --enable-xml --disable-rpath --enable-bcmath --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --with-mcrypt-dir=/usr/local/Cellar/mcrypt/2.6.8/ --with-gd --with-openssl=/usr/local/opt/openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --disable-fileinfo --enable-maintainer-zts --enable-mysqlnd --with-freetype-dir=/usr/local/Cellar/freetype/2.9.1/

5、make clean; make; make install;

6、顺便在发一个关闭php-fpm服务的命令:

ps -eaf |grep "php-fpm" | grep -v "grep"| awk '{print $2}'|xargs kill -9

完毕

xampp (phpStudy重新编译版) 2016 此版本由phpStudy作者重新编译,精简掉五分之四,安装包只有35M; 原xampp解压后1250M,去臃肿精简掉980M仅剩250M。 对控制面板进行大幅优化更新, 放弃掉旧版本许多无用的鸡肋功能。 增加 PHP5.3、PHP5.5和PHP7.0 一键切换。将程序汉化修改,增加部分功能。 将apache升级到最新版2.4.18,php升级到5.6.16和7.0.1。 mysql升级到5.7.10,tomcat升级到7.0.56。 程序包35M,解压后,启动即可,易于安装和设置。 ### 注意: PHP5.3、php5.4需要安装32位的vc9运行库; php5.6需要安装32位的vc11运行库。 php7.0需要安装32位的vc14运行库。 新增PHP5.3、PHP5.6和PHP7.0一键切换;点 [PHP切换] 进行切换。 ### MySQL 默认密码 ### User: root Password:root 安装使用: 1: 勾选 [Service] 那栏下的按钮, 实现安装服务. 2: 点击各功能的 start 按钮来启动进程. 3: 点击各功能的 admin 按钮来管理功能. 4: 启动 tomcat 需要先安装JDK. 如何卸载: 通过 点 [其他工具] > [卸载全部服务] 或点托盘菜单 > [卸载服务] 卸载相关服务后删除即可。 作者的集成包: 1: phpStudy PHP集成包 phpStudy 支持php5.2到7.0一键切换,24种组合自由切换。 phpStudy全面支持Apache | Nginx | IIS 6/7/8 | Lighttpd; 支持站点设置,数据库备份还原等功能强大。 2: JspStudy JSP+PHP集成包 JspStudy 支持tomcat6和tomcat7一键切换;支持服务和非服务模式运行。 JspStudy集成JDK+tomcat +Apache+PHP+MySQL,将复杂的JSP环境配置简单化。 无需设置环境变量一键配好JSP+PHP环境。 phpStudy+JspStudy 详情访问 http://www.phpstudy.net/a.php/207.html 寻求帮助访问官网: http://www.xampps.com scp1688@163.com http://www.xampps.com
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值