Home > Backend Development > PHP Tutorial > 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
Release: 2016-07-29 08:49:20
Original
1460 people have browsed it

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
Copy after login
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
Copy after login
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
Copy after login
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.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template