php 验证mac,mac 上 php 验证码不显示图片

20190718 学习做一个 thinkphp5 的验证码,结果发现在我的 macbook 上死活不出图片,但是在windows 上是可以的!断定问题出在环境上!

macOS Mojave 10.14.5

WEB: 自带的 apache

PHP:自带的 php 7.1

经过了一大圈重装 apache 和 php 之后,终于是出来了!

1、 现状

e43fb6696fd4a7e753709d7c2c96734f.png

2、之前是这样的

26f213f662bd7773d450b152b44d47d5.png

3、记录一下分析和解决的过程

以上 3 个实际上和 php 代码没有什么关系!

$ brew info gd gd: stable 2.2.5 (bottled), HEAD

Graphics library to dynamically manipulate images

https://libgd.github.io/

Not installed

From: https://mirrors.ustc.edu.cn/homebrew-core.git/Formula/gd.rb

==> Dependencies

Required: fontconfig ✘, freetype ✘, jpeg ✘, libpng ✔, libtiff ✘, webp ✘

==> Options

--HEAD

Install HEAD version

把以上 打X 的一个一个安装上!

brew install fontconfig brew install freetype brew install jpeg brew install libtiff brew install webp

一个一个确认一下

brew info freetype brew info jpeg brew info libpng brew info zlib

zlib: stable 1.2.11 (bottled) [keg-only]

General-purpose lossless data-compression library

https://zlib.net/

Not installed

From: https://mirrors.ustc.edu.cn/homebrew-core.git/Formula/zlib.rb

==> Caveats

This formula is keg-only, which means it was not symlinked into /usr/local,

because macOS already provides this software and installing another version in

parallel can cause all kinds of trouble.

再次安装 brew install zlib

发现问题出在 freetype brew install freetype Updating Homebrew... Warning: freetype 2.9.1 is already installed, it's just not linked You can use brew link freetype to link this version.

brew link freetype Linking /usr/local/Cellar/freetype/2.9.1...

Error: Could not symlink share/aclocal/freetype2.m4

/usr/local/share/aclocal is not writable.

再来 $ sudo chmod -R 777 aclocal $ brew link freetype Linking /usr/local/Cellar/freetype/2.9.1... 8 symlinks created

$ sudo apachectl restart 正以为一切 ok 的时候,却绝望的发现一切依然!

这才有了以上折腾一大圈!重装 apache!重装 php!

4、 经验总结:

是否支持 freetype ,光从命令行 php -m 和以上 brew install ,brew info 是不行的!

Mac 系统太顽固了! 系统中的 freetype 不一定就加载到了 apache ! 据说这是新版内置 apache 才开始的,以前的版本没有这个问题!

判断 WEB 是否支持 freetype,只有这样子 phpinfo 去查看

57622d4af2408c38b0c2f9494d8b6efd.png

之前的图没有保存!但是,确实记得,没有找到 freetype 的影子!

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值