php错误集合

PHP发生Call to undefined function imagecreate()错误的解决办法

在使用php处理一些图像时,有时会出现诸如这样的错误:Call to undefined function imagecreate()

这是由于没有安装或是没有开启php的gd库导致的问题。

解决方案:

一、在linux系统(这里用的是Ubuntu系统)下

首先在终端输入下列命令:

  1. sudo apt-get install php5-gd  

这样就已经安装完php的gd库了。如果使用的是apache服务器,这时还需重启下服务器:

  1. sudo service apache2 restart  

如果是nginx则可用可不用。

二、在windows系统下

打开php安装目录下的php.ini配置文件,找到这一行:

 
  1. ;extension=php_gd2.dll  

将这一行前面的;号去掉,然后保存。这样已经开启了gd扩展库。

最后重启下服务器就行了。

三、centos(6.8)

安装插件                  yum -y install php-gd

重启apache服务      service httpd restart

原文地址:https://www.cnblogs.com/bky185392793/p/8268302.html