1

I've installed PHP 5.5 on CentOS using the IUS repos and unfortunately I cannot use GD even after installing everything recommended:

Package php55u-gd-5.5.14-1.ius.centos6.x86_64 already installed and latest version
Package gd-2.0.35-11.el6.x86_64 already installed and latest version
Package gd-devel-2.0.35-11.el6.x86_64 already installed and latest version
Package freetype-2.3.11-14.el6_3.1.x86_64 already installed and latest version
Package freetype-devel-2.3.11-14.el6_3.1.x86_64 already installed and latest version

How would I go about enabling the GD text functions in PHP?

/etc/php.d/gd.ini

; Enable gd extension module
extension=gd.so
Jordan Doyle
  • 2,976
  • 4
  • 22
  • 38
  • 1
    did you check if gd actually shows up in `phpinfo()` output, and restart Apache after installing the packages? – Marc B Jul 11 '14 at 17:05
  • thanks for the reply, mark. yeah i did restart Apache and GD comes up under the `Module Authors` section and only there – Jordan Doyle Jul 11 '14 at 17:08
  • I have just noticed an error when running php -a `PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/gd.so' - libvpx.so.0: cannot map zero-fill pages: Cannot allocate memory in Unknown on line 0` not sure if this helps at all – Jordan Doyle Jul 11 '14 at 17:22
  • 1
    Apparently GD needs swap space on CentOS, at least according to http://stackoverflow.com/questions/20274938/php-gd-library-installed-but-not-functioning-on-centos-6-4 – cOle2 Jul 11 '14 at 17:26

2 Answers2

3

I noticed when running php -a that there was an error saying PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/gd.so' - libvpx.so.0: cannot map zero-fill pages: Cannot allocate memory in Unknown on line 0. Due to this being a production system I don't have errors showing on the webserver but I do feel stupid now.

I traced the error back to a question on StackOverflow which informed me I needed swap space on my VM which I fixed by running:

sudo dd if=/dev/zero of=/swapfile bs=1024 count=512k
sudo mkswap /swapfile
sudo swapon /swapfile

Well done to cOle2 for spotting this whilst I was writing this up.

Thanks for your help.

Community
  • 1
  • 1
Jordan Doyle
  • 2,976
  • 4
  • 22
  • 38
1

PHP Fatal error: Call to undefined function imagettftext()

"According to the PHP manual entry for imagettftext():

This function requires both the GD library and the » FreeType library.

You must be missing one or both of the required libraries in your PHP build."

Community
  • 1
  • 1
Joe T
  • 2,300
  • 1
  • 19
  • 31