Welcome to Linux Forums! With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.
Find the answer to your Linux question:
New to Linux Forums? Register here for free!
    Linux Forums > GNU Linux Zone > Linux Programming & Scripting > GD not loaded though compiled, resulting in "Call to undefined function"

Forgot Password?
 Linux Programming & Scripting   C, Perl, PHP, Bash Scripts, anything programming or script related post in here!

Site Navigation
Linux Articles
Linux Forums
Linux Downloads
Linux Hosting
Free Magazines
Job Board
IRC Chat
RSS Feeds


Linux Forum Topics
Linux Forums
Your Distro
Linux Resources
GNU Linux Zone
The Community
Reply
 
Thread Tools Display Modes
Old 07-24-2006   #1 (permalink)
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
czamora is offline  


Reply With Quote
Old 07-26-2006   #2 (permalink)
Just Joined!
 
Join Date: May 2006
Posts: 33
Is any other data needed?
czamora is offline   Reply With Quote
Old 07-26-2006   #3 (permalink)
Trusted Penguin
 
Cabhan's Avatar
 
Join Date: Jan 2005
Location: Boston, MA, USA
Posts: 2,691
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:
Quote:
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=Gentoo
Registered Linux User #388732
Gentoo Linux, 410 GB HD, 1.2 GB RAM, Fluxbox, These are a Few of my Favorite Things
Cabhan is offline   Reply With Quote
Old 08-01-2006   #4 (permalink)
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.
czamora is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Free Magazines
Run Your Own Web Server Using Linux & Apache - Free 191 Page Preview
Learn about everything you'll need to build and maintain your Linux servers, and to deploy Web applications to them.
subscribe
Open Source Security Myths Dispelled
Dispel the five major myths surrounding Open Source Security and gain the tools necessary to make a truly informed decision for your IT organization
subscribe
InformationWeek
InformationWeek is the only newsweekly you'll need to stay on top of the latest developments in information technology.
subscribe



All times are GMT. The time now is 08:32 AM.






© 2000 - 2009 - All Rights Reserved - Property of  MAS Media

Content Relevant URLs by vBSEO 3.3.0 RC2