Fatal error: Call to undefined function imagecreate()解决办法:
此原因一般情况下主要是gd库没有安装成功
下载freetype并解压,进行安装,安装命令:
./configure --prefix=/var/local/lnmp/freetype-2.6
make
make install
下载jpegsrc并解压,进行安装,安装命令:
./configure --prefix=/var/local/lnmp/jpegsrc-v9b
make
make install
下载libpng并解压,进行安装,安装命令:
./configure --prefix=/var/local/lnmp/libpng-1.6
make
make install
进入PHP安装源码目录/var/local/lnmp1/php-7.0/ext/gd
如果之前make安装失败了需要先make clean清楚安装
/var/local/lnmp/php-7.0/bin/phpize
./configure --with-php-config=/var/local/lnmp/php-7.0/bin/php-config --with-freetype-dir=/var/local/lnmp/freetype-2.6/ --with-jpeg-dir=/var/local/lnmp/jpegsrc-v9b/ --with-png-dir=/var/local/lnmp/libpng-1.6/
make
make install
在php.ini文件中添加extension=gd.so
lnmp重启php-fpm,lamp重启apache
扩展添加到此结束