LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-24-2006, 03:26 PM   #1
czamora
Member
 
Registered: May 2006
Posts: 52

Rep: Reputation: 15
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
 
Old 07-25-2006, 09:35 AM   #2
jstephens84
Senior Member
 
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098

Rep: Reputation: 102Reputation: 102
Try locating the actual .so file. When I installed it on Ubuntu I kept getting the exact same error that you are when I was trying to install eventum. All I did you fix that issue is located the actual gd.so and place a copy of it in the extensions directory. All so can you place what you got from phpinfo(). If you have not created that yet then do this.
Code:
<html>
<head>
<title>PHP Information</title>
</head>
<body>
<?phpinfo();?>
</body>
</html>
This will also let you know where you extension directory is.
 
Old 07-25-2006, 03:09 PM   #3
czamora
Member
 
Registered: May 2006
Posts: 52

Original Poster
Rep: Reputation: 15
The problem is I don't know what the name of the library file should be.

I have made a search for gd.so:

find / -name gd.so

and found nothing.
So I performed a more generic search:

find / -name "*gd*.so*"

and found

/usr/lib/libgd.so.2
/usr/lib/libgd.so
/usr/lib/libgdbm.so.2
/usr/lib/libgd.so.2.0.0
/usr/lib/python2.3/lib-dynload/gdbmmodule.so
/usr/lib/libgdbm.so.2.0.0

of which /usr/lib/libgd.so and /usr/lib/libgd.so.2 are links to /usr/lib/libgd.so.2.0.0

But that is the one that, when in my extensions directory, causes the error I mentioned:

PHP Warning: Unknown(): Invalid library (maybe not a PHP library) 'libgd.so.2.0.0' in Unknown on line 0
 
Old 07-26-2006, 05:18 AM   #4
czamora
Member
 
Registered: May 2006
Posts: 52

Original Poster
Rep: Reputation: 15
Oh, and the output of phpinfo() is too large to post it here. Any specific data you need?
 
Old 07-26-2006, 10:04 AM   #5
jstephens84
Senior Member
 
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098

Rep: Reputation: 102Reputation: 102
I would like to see where your extension directories are located. Also you might try and download php from the website and see if it comes with a module that can be loaded. If it does then just copy that to your extension directory.
 
Old 07-26-2006, 04:53 PM   #6
czamora
Member
 
Registered: May 2006
Posts: 52

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by jstephens84
I would like to see where your extension directories are located. Also you might try and download php from the website and see if it comes with a module that can be loaded. If it does then just copy that to your extension directory.
The extensions directory for php would be /usr/lib/php4, as indicated in the php.ini file:

; Directory in which the loadable extensions (modules) reside.
extension_dir = /usr/lib/php4


In that directory I only have mysql.so

Regarding the downloading of php, I'm afraid the official site (php.net) only offers binaries for Windows. I have found on the net a non-source rpm, php-4.3.9-3.12.i386.rpm, but this is all it contains:

[root@site ~]# rpm -qps php-4.3.9-3.12.i386.rpm
warning: php-4.3.9-3.12.i386.rpm: V3 DSA signature: NOKEY, key ID 9b3c94f4
normal /etc/httpd/conf.d/php.conf
normal /etc/pear.conf
normal /etc/php.d
normal /etc/php.ini
normal /usr/bin/php
normal /usr/lib/httpd/modules/libphp4.so
normal /usr/lib/php4
normal /usr/share/doc/php-4.3.9
normal /usr/share/doc/php-4.3.9/CODING_STANDARDS
normal /usr/share/doc/php-4.3.9/CREDITS
normal /usr/share/doc/php-4.3.9/EXTENSIONS
normal /usr/share/doc/php-4.3.9/INSTALL
normal /usr/share/doc/php-4.3.9/LICENSE
normal /usr/share/doc/php-4.3.9/NEWS
normal /usr/share/doc/php-4.3.9/README.EXTENSIONS
normal /usr/share/doc/php-4.3.9/README.EXT_SKEL
normal /usr/share/doc/php-4.3.9/README.PARAMETER_PARSING_API
normal /usr/share/doc/php-4.3.9/README.SELF-CONTAINED-EXTENSIONS
normal /usr/share/doc/php-4.3.9/README.STREAMS
normal /usr/share/doc/php-4.3.9/README.SUBMITTING_PATCH
normal /usr/share/doc/php-4.3.9/README.TESTING
normal /usr/share/doc/php-4.3.9/README.UNIX-BUILD-SYSTEM
normal /usr/share/doc/php-4.3.9/TSRM_LICENSE
normal /usr/share/doc/php-4.3.9/ZEND_CHANGES
normal /usr/share/doc/php-4.3.9/ZEND_LICENSE
normal /usr/share/doc/php-4.3.9/gd_README
normal /usr/share/doc/php-4.3.9/regex_COPYRIGHT
normal /var/lib/php
normal /var/lib/php/session
normal /var/www/icons/php.gif


So, no libraries there.

On the other hand, the source for php does seem to contain the code for gd:

[root@site php-4.4.2]# ls -l ext/gd
total 204
-rw-r--r-- 1 1000 1000 14867 May 17 2005 config.m4
-rw-r--r-- 1 1000 1000 102 Feb 28 2003 CREDITS
-rw-r--r-- 1 1000 1000 104945 Jan 1 2006 gd.c
-rw-r--r-- 1 1000 1000 4998 Jan 9 2005 gdcache.c
-rw-r--r-- 1 1000 1000 2880 Mar 5 2003 gdcache.h
-rw-r--r-- 1 1000 1000 3824 Jan 1 2006 gd_ctx.c
-rw-r--r-- 1 1000 1000 16313 Jul 22 2004 gd.dsp
-rw-r--r-- 1 1000 1000 23316 Jan 9 2005 gdttf.c
-rw-r--r-- 1 1000 1000 461 Feb 25 2000 gdttf.h
drwxr-xr-x 2 1000 1000 4096 Jan 12 2006 libgd
-rw-r--r-- 1 1000 1000 5976 Jan 1 2006 php_gd.h
drwxr-xr-x 2 1000 1000 4096 Jan 12 2006 tests

But I don't know how to compile that without a compile script.
 
Old 07-26-2006, 05:24 PM   #7
jstephens84
Senior Member
 
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098

Rep: Reputation: 102Reputation: 102
I would probably uninstall your php then use the source you downloaded then reinstall php. check the ./configure for all the options that you can use.
 
Old 07-27-2006, 05:50 AM   #8
czamora
Member
 
Registered: May 2006
Posts: 52

Original Poster
Rep: Reputation: 15
Yes, but I have done that already in a previous server and I had to leave it because it started failing and not executing php and nobody could find the reason, so I'm scared of installing things myself.

Furthermore, when I try ./configure for the php source it complains that Apache was not built with so support, so I would have to reinstall Apache too, and that's a lot of fuss (and exactly what I was forced to do in my previous server which went down).

Any ideas on how to fix the linking problem without having to reinstall php from source?
 
Old 07-27-2006, 10:11 AM   #9
jstephens84
Senior Member
 
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098

Rep: Reputation: 102Reputation: 102
Ok, I will try and research and look around for possible fixes.
 
Old 07-27-2006, 03:17 PM   #10
czamora
Member
 
Registered: May 2006
Posts: 52

Original Poster
Rep: Reputation: 15
Thanks a lot. I'll look forward to your advice.
 
Old 07-27-2006, 03:31 PM   #11
jstephens84
Senior Member
 
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098

Rep: Reputation: 102Reputation: 102
check to see what your ld.so.conf file has in it.
 
Old 07-27-2006, 03:37 PM   #12
jstephens84
Senior Member
 
Registered: Sep 2004
Location: Nashville
Distribution: Manjaro, RHEL, CentOS
Posts: 2,098

Rep: Reputation: 102Reputation: 102
See if any of this applies to you also. http://bugs.php.net/bug.php?id=36208
 
Old 08-01-2006, 11:10 AM   #13
czamora
Member
 
Registered: May 2006
Posts: 52

Original Poster
Rep: Reputation: 15
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.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Any way to get "Alice"; "Call of Duty" series and "Descent 3" to work? JBailey742 Linux - Games 13 06-23-2006 01:34 PM
"undefined reference" to a template class function btb Programming 3 08-25-2005 05:02 PM
"Function not implemented" error in call to "sem_open()" Krishnendu8 Linux - Newbie 1 06-07-2003 02:52 AM
"Function not imlemented" error in call to "sem_open()" Krishnendu8 Linux - Networking 0 06-07-2003 02:19 AM
Undefined call to "_fxstat" Deadman Inc. Linux - Software 1 07-25-2002 09:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:33 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration