Find the answer to your Linux question:
Results 1 to 4 of 4
Hi, My current php installation (version 4.3.9) was built with GD: --with-gd=shared --enable-gd-native-ttf --without-gdbm but when I try to use any GD functions I get: PHP Fatal error: Call to ...
  1. #1
    Just Joined!
    Join Date
    May 2006
    Posts
    33

    GD not loaded though compiled, resulting in "Call to undefined function"



    Hi,

    My current php installation (version 4.3.9) was built with GD:

    --with-gd=shared --enable-gd-native-ttf --without-gdbm

    but when I try to use any GD functions I get:

    PHP Fatal error: Call to undefined function: imagefontheight()

    GD is installed on my system (Linux Centos 4.3), as indicated by yum, and by the fact that Webmin uses it.

    I have tried loading it as an extension, by including the line
    extension=libgd.so
    in a file inside /etc/php.d, but it does not find that library. If I link /usr/lib/php4/libgd.so to the actual library file in /usr/lib/libgd.so.2, then it complains that the file is not a php extension library.

    I don't know what else to do, or what can be wrong.

    Any help will be greatly appreciated.

    get_loaded_extensions() gives:
    Array
    (
    \[0] => yp
    [1] => xml
    [2] => wddx
    [3] => tokenizer
    [4] => sysvshm
    [5] => sysvsem
    [6] => standard
    [7] => sockets
    [8] => shmop
    [9] => session
    [10] => pspell
    [11] => posix
    [12] => pcre
    [13] => overload
    [14] => mime_magic
    [15] => iconv
    [16] => gmp
    [17] => gettext
    [18] => ftp
    [19] => exif
    [20] => dio
    [21] => dbx
    [22] => dba
    [23] => curl
    [24] => ctype
    [25] => calendar
    [26] => bz2
    [27] => bcmath
    [28] => zlib
    [29] => openssl
    [30] => apache2handler
    [31] => mysql
    )

    The complete ./configure options for php were:

    ./configure --build=i686-redhat-linux-gnu --host=i686-redhat-linux-gnu --target=i386-redhat-linux-gnu --program-prefix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info --cache-file=../config.cache --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --enable-force-cgi-redirect --disable-debug --enable-pic --disable-rpath --enable-inline-optimization --with-bz2 --with-db4=/usr --with-curl --with-exec-dir=/usr/bin --with-freetype-dir=/usr --with-png-dir=/usr --with-gd=shared --enable-gd-native-ttf --without-gdbm --with-gettext --with-ncurses=shared --with-gmp --with-iconv --with-jpeg-dir=/usr --with-openssl --with-png --with-pspell --with-xml --with-expat-dir=/usr --with-dom=shared,/usr --with-dom-xslt=/usr --with-dom-exslt=/usr --with-xmlrpc=shared --with-pcre-regex=/usr --with-zlib --with-layout=GNU --enable-bcmath --enable-exif --enable-ftp --enable-magic-quotes --enable-sockets --enable-sysvsem --enable-sysvshm --enable-track-vars --enable-trans-sid --enable-yp --enable-wddx --with-pear=/usr/share/pear --with-imap=shared --with-imap-ssl --with-kerberos --with-ldap=shared --with-mysql=shared,/usr --with-pgsql=shared --with-snmp=shared,/usr --with-snmp=shared --enable-ucd-snmp-hack --with-unixODBC=shared,/usr --enable-memory-limit --enable-shmop --enable-calendar --enable-dbx --enable-dio --enable-mbstring=shared --enable-mbstr-enc-trans --enable-mbregex --with-mime-magic=/usr/share/file/magic.mime --with-apxs2=/usr/sbin/apxs

  2. #2
    Just Joined!
    Join Date
    May 2006
    Posts
    33
    Is any other data needed?

  3. #3
    Trusted Penguin Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,204
    Well, I ran the message through Google, and it's not an uncommon problem, so it seems. Before I tell you what I found, I should mention that I do not know PHP.

    Now then, some solutions seemed to be:
    4) edit /etc/php/apach2-php4/php.ini
    uncomment the "extension=php_gd2.dll" line

    5) Restart apache2

    /etc/init.d/apache2 restart

    -- http://us2.php.net/imageCreate()

    If you compiled PHP yourself but get an error:
    Fatal error: Call to undefined function imagettftext().

    You need to compile PHP with more options.

    --with-gd
    --enable-gd-native-ttf
    --with-png
    --with-zlib-dir=/usr/local/lib/zlib-1.2.1
    --with-ttf
    --with-jpeg-dir=/usr/local/lib/jpeg-6b/
    --with-freetype-dir=/usr/local/lib/freetype-2.1.9/
    --with-xpm-dir=/usr/X11R6/

    The next set deal with setting up GD, and the appropriate options. Just enabling GD, ttf, png & jpeg is NOT enough. You also need Freetype and XPM.

    -- http://theserverpages.com/php/manual...agettftext.php

    If you have configured and compiled PHP with all the necessary command-line options and still get the error:

    Fatal error: Call to undefined function imagettftext()

    Try doing a "make clean" before building the php apache module:

    ./configure [...]
    make clean
    make
    make install

    This may solve your problem (and hopefully keep you from wasting hours trying different compile options!)

    -- http://www.usphp.com/function.imagettftext.html
    Try these, and if they don't work, keep going through Google. I got 382 hits for your error message.
    DISTRO=Arch
    Registered Linux User #388732

  4. #4
    Just Joined!
    Join Date
    May 2006
    Posts
    33
    Just for everybody's reference, the solution, as pointed out at the centos.org forum, was simply to check for packages related to GD, with:

    yum list *gd*

    Then, I could see there is package called php-gd.i386 that was not installed on my system.

    The only thing I had to do was to install that package:

    yum install php-gd.i386

    and restart Apache.

    It worked like magic!

    Thanks to all for your help anyways.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •