>  기사  >  백엔드 개발  >  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으로 문의하세요.