Home  >  Article  >  Backend Development  >  Solution to the Call to undefined function imagecreate error in PHP undefined index undefined reference undefined variabl

Solution to the Call to undefined function imagecreate error in PHP undefined index undefined reference undefined variabl

WBOY
WBOYOriginal
2016-07-29 08:49:201446browse

When using php to process some images, sometimes errors such as this will occur: Call to undefined function imagecreate()

This is a problem caused by the gd library of php not being installed or not enabled.

Solution:

1. Under the Linux system (Ubuntu system is used here)

First enter the following command in the terminal:

sudo apt-get install php5-gd
In this way, the gd library of php has been installed. If you are using an apache server, you need to restart the server at this time:
sudo service apache2 restart
can be used or not if it is nginx.

2. Under Windows system

Open the php.ini configuration file in the php installation directory and find this line:

;extension=php_gd2.dll
Remove the ; sign in front of this line and save it. This has enabled the gd extension library.

Finally just restart the server.

The above introduces the solution to the Call to undefined function imagecreate error in PHP, including undefined and function aspects. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn