后来手工编译gd扩展,加入后,通过php -m可以看到gd扩展了,但是验证码依然不出来,报函数不存在
通过以下命令验证:
/usr/local/php8.3/bin/php -r "var_dump(function_exists('imagettftext'));"
bool(false)
/usr/local/php8.3/bin/php -i | grep -A5 "GD Support"
GD Support => enabled
GD Version => bundled (2.1.0 compatible)
GIF Read Support => enabled
GIF Create Support => enabled
PNG Support => enabled
libPNG Version => 1.6.37
得到imagettftext函数不存在,重新多次编译GD或者整个PHP,最后解决。
可能的原因是:
PHP 编译时根本没检测到 freetype 库,所以imagettftext()依然返回false。核心问题是pkg-config工具没正确识别 freetype,导致--with-freetype参数失效。
放上最后成功的完整脚本。
评论0
暂时没有评论