首页  >  文章  >  后端开发  >  PHP发生Call to undefined function imagecreate错误的解决办法 undefined index undefined reference undefined variabl

PHP发生Call to undefined function imagecreate错误的解决办法 undefined index undefined reference undefined variabl

WBOY
WBOY原创
2016-07-29 08:49:201425浏览

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

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

解决方案:

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

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

sudo apt-get install php5-gd
这样就已经安装完php的gd库了。如果使用的是apache服务器,这时还需重启下服务器:
sudo service apache2 restart
如果是nginx则可用可不用。

二、在windows系统下

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

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

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

以上就介绍了PHP发生Call to undefined function imagecreate错误的解决办法,包括了undefined,function方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn