阿里云服务器上编译安装的PHP,gd库没有freetype扩展,尝试了重新编译安装gd库和PHP都没有效果。

php.ini中添加了gd.so:
extension=/usr/local/php74/lib/php/extensions/no-debug-zts-20190902/gd.so
PHP版本是7.4.32,配置命令如下:

gd库的配置命令如下:

阿里云服务器上编译安装的PHP,gd库没有freetype扩展,尝试了重新编译安装gd库和PHP都没有效果。

php.ini中添加了gd.so:
extension=/usr/local/php74/lib/php/extensions/no-debug-zts-20190902/gd.so
PHP版本是7.4.32,配置命令如下:

gd库的配置命令如下:

关注【相关推荐】
正常执行configure时报错:
checking for libpng... which: no libpng-config in (/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)
configure: error: `libpng-config' not found;
either set the LIBPNG_CFLAGS and LIBPNG_LDFLAGS environment variables,
or pass `--without-png' to the `configure' script.
make: *** [setup] Error 1
开始我天真地以为,加上--with-png=/usr/local/libpng就可以了,而且理论上这是可以满足要求的,因为libpng的安装目录结构完好,其bin目录下确实有libpng-config,咋就不行了?而且--with-png这个参数也不是瞎给的,给错会提示。
我注意到它搜索的路径其实是path环境变量,但是我的习惯是,临时用一下不值得去修改一些固定的东西。所以我使用了():
(PATH=$PATH:/usr/local/libpng/bin;./configure --prefix=/usr/local/freetype --enable-shared)
make -j 4 && make install
括号里临时执行一下即可,然后编译成功。