mac 上 php 验证码不显示图片

20190718 学习作一个 thinkphp5 的验证码,结果发如今个人 macbook 上死活不出图片,可是在windows 上是能够的!判定问题出在环境上!

macOS Mojave 10.14.5 
WEB: 自带的 apache
PHP:自带的 php 7.1

通过了一大圈重装 apache 和 php 以后,终因而出来了!php

一、 现状

二、以前是这样的

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

重装 apache 和 php 的过程分别记录在了 MacBook 重装 Apache 和 PHP 7.2 https://blog.csdn.net/u010953609/article/details/96474165 Mac 重装 Apache 后中文目录乱码 https://blog.csdn.net/u010953609/article/details/96479940 macbook 系统 php 版本和 web 的 php 版本不同,brew link php 失败 https://blog.csdn.net/u010953609/article/details/96480355git

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

  1. $ brew info gdweb

    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 的一个一个安装上!thinkphp

brew install fontconfig brew install freetype brew install jpeg brew install libtiff brew install webpapache

一个一个确认一下windows

brew info freetype brew info jpeg brew info libpng brew info zlibless

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 zlibide

  1. 发现问题出在 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.thinkphp5

  2. 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.
  3. 再来 $ sudo chmod -R 777 aclocal $ brew link freetype Linking /usr/local/Cellar/freetype/2.9.1... 8 symlinks created

  4. $ sudo apachectl restart 正觉得一切 ok 的时候,却绝望的发现一切依然!

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

四、 经验总结:

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

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

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

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

相关文章
相关标签/搜索