Yii 2 giving an exception when clicking on the default contact tab
Solution 1
For solve problem, first install php-gd
module on your system. After that open php.ini
on your editor and search for ;extension=gd.so
and remove the heading ; sign. Then restart your apache service ;).
For Arch Linux you can do followings (Lines that begins with #
are command of terminal):
# pacman -S php-gd
# vim /etc/php/php.ini
- Press
/
and typegd
then pressEnter
- Find
;extension=gd.so
and convert it intoextension=gd.so
by moving cursor on;
sign and pressx
- Press
Esc
and type:wq
and pressEnter
# systemctl restart httpd.service
Solution 2
With this two lines it is okeyokay:
sudo apt install php-gd
sudo service apache2 restart
Solution 3
As suggested in the comments.
The contact form contains a .png picture in the form of a captcha image. The captcha image is used there to prevent spam being send via the contact form.
- You can edit the view page and remove the captcha
- You can install php-gd or php-imagick extension
Comments
-
J_Strauton almost 2 years
I am getting this error when I run on my mac with localhost.
Either GD PHP extension with FreeType support or ImageMagick PHP extension with PNG support is required.
I think the problem comes with the PNG picture that is being rendered by default on the contact page. All of the code is the basic code that is given by the Yii framework: here Only happens when I click the
Contact
tab on the navigation bar. -
Mr C over 3 yearswindows, default php.ini file is comment this gd extension, so we only need to uncomment and restart php-fpm process.