Home > Article > Backend Development > Solution to the Call to undefined function imagecreate error in PHP undefined index undefined reference undefined variabl
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-gdIn 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 restartcan 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.dllRemove 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.