PHP7 在mac运行thinkphp5问题

1、
thinkphp 验证码在 macOS Sierra 10.12 上无法显示,提示下面的错误:
Call to undefined function think\captcha\imagettftext()

或:
Call to undefined function Think\imagettftext()

首先确定该问题为缺失 FreeType 扩展引起的,查看系统信息(phpinfo),找到 gd 项,查看有无 `` 四项,如无,说明 FreeType 未安装或未完整安装。
解决方案一:https://php-osx.liip.ch 一句话脚本(One Line Installation)
为系统 GD 库安装 FreeType 解决问题,打开终端输入:
curl -s http://php-osx.liip.ch/install.sh | bash -s 5.6

这里的 5.6 对应本机的 PHP 版本

终端自动执行,根据网速稍微缓慢~
$ curl -s http://php-osx.liip.ch/install.sh | bash -s 5.6

或者
curl -s https://php-osx.liip.ch/install.sh | bash -s force 7.1.23


[WARNING]
Detected macOS Sierra 10.12. As this is quite new, there may be issues still. Your mileage may vary.


Get packager.tgz
Unpack packager.tgz
Please type in your password, as we want to install this into /usr/local
Password:
Start packager (may take some time)
downloading https://s3-eu-west-1.amazonaws.com/php-osx.liip.ch/install/5.6-10.10-frontenddev-latest.dat
downloading https://s3-eu-west-1.amazonaws.com/php-osx.liip.ch/install/5.6-10.10/frontenddev/5.6-10.10-frontenddev-5.6.27-20161101-100213.tar.bz2

安装成功,重启 Apache 服务:
$ sudo apachectl restart

作者:djyuning
链接:https://www.jianshu.com/p/91216a383097
来源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

2、安装
点击brew官网:
在自己的terminal中输入该命令

/usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

3、使用MAMP代替mac原来的Apache和php,mysql可以另外安装,也可以使用MAMP的mysql。如果另外安装mysql,则需要在php中把原有路径更改:
mysqli.default_socket = /tmp/mysql.sock
pdo_mysql.default_socket = /tmp/mysql.sock

注:/tmp/mysql.sock是另外安装mysql的地址。

MAMP下载地址:
http://down-www.newasp.net/pcdown/soft/mac/mamp_pro.zip

猜你喜欢

转载自blog.csdn.net/kunga0814/article/details/88393968
今日推荐