php 验证码 imagettftext() 安装,Mac 自带 PHP 无 imagettftext 函数

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

****

[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

参考文章

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值