LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 01-22-2006, 09:08 PM   #1
BCarey
Senior Member
 
Registered: Oct 2005
Location: New Mexico
Distribution: Slackware
Posts: 1,639

Rep: Reputation: Disabled
php5 compile woes: undefined function imagettftext


well, that's pretty much the problem, I get: [CODE]Fatal error: Call to undefined function imagettftext()[\CODE] when I run, eg. the following
Code:
<?php
 DEFINE ("TTF_DIR","/usr/X11R6/lib/X11/fonts/TTF/" );

$im = imagecreatetruecolor (400, 100);
$black = imagecolorallocate ($im, 0, 0, 0);
$white = imagecolorallocate ($im, 255, 255, 255);

imagerectangle ($im,0, 0,399,99 ,$black);
imagefilledrectangle ($im,0, 0,399,99 ,$white);

imagettftext ($im, 30, 0, 10, 40 , $black, TTF_DIR. "arial.ttf", "Hello World!");

header ("Content-type: image/png" );
imagepng ($im);	
?>
This is my config line:
Code:
./configure --with-apxs --with-mysql=/usr/share/mysql --with-unixODBC --with-pgsql
--with-mysqli=/usr/bin/mysql_config --with-xmlrpc --with-gd --enable-gd-native-ttf 
--with-jpeg-dir=/usr --with-png -with-ttf-dir=/usr/lib --with-zlib-dir=/usr/include/zlib 
--with-freetype-dir=/usr/local/lib
Any help would be greatly appreciated.

Thanks,
Brian
 
Old 01-22-2006, 09:22 PM   #2
irpstrcr
Member
 
Registered: Mar 2005
Location: LAX
Distribution: Slackware
Posts: 40

Rep: Reputation: 15
A quick guess would be php looking for libfreetype in the wrong place.
 
Old 01-22-2006, 09:35 PM   #3
BCarey
Senior Member
 
Registered: Oct 2005
Location: New Mexico
Distribution: Slackware
Posts: 1,639

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by irpstrcr
A quick guess would be php looking for libfreetype in the wrong place.
It would seem that way, but I did specify the path to libfreetype in the configuration.

Brian
 
Old 01-22-2006, 09:46 PM   #4
irpstrcr
Member
 
Registered: Mar 2005
Location: LAX
Distribution: Slackware
Posts: 40

Rep: Reputation: 15
ask the mighty ldd if it is where it thinks it is

ldd /path/to/php <-- this will tell you if, what and where the libs php knows about reside

or if you just want to see if it knows about libfreetype.so

ldd /path/to/php | grep libfreetype
 
Old 01-22-2006, 09:54 PM   #5
BCarey
Senior Member
 
Registered: Oct 2005
Location: New Mexico
Distribution: Slackware
Posts: 1,639

Original Poster
Rep: Reputation: Disabled
Indeed I get
Code:
        libfreetype.so.6 => /usr/local/lib/libfreetype.so.6 (0xb7e17000)
which seems to be okay.

Thanks for teaching me the ldd command. :=)

Brian

Last edited by BCarey; 01-22-2006 at 09:56 PM.
 
Old 05-18-2007, 11:42 PM   #6
abbnam
LQ Newbie
 
Registered: May 2007
Posts: 1

Rep: Reputation: 0
after all that......

I also had this very same problem. Even though i compiled/linked against the freetype library (many-many times!) and verified it using ldd (as described above) I still received the error.

The problem, it turns out, is that I had two php executables, one in "/usr/bin" and one in "/usr/local/bin"

after "make install" the output was being installed in "/usr/bin" but my path was picking up the "/usr/local/bin" which had an older (non-freetype linked) php executable.

If, like me, you have tried everything suggested on the internet (including the previous posts here), then check you don't have two copies of php...



A.
 
  


Reply

Tags
php5, undefined



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
Call to undefined function domxml_open_mem() apt Programming 2 04-01-2005 03:25 AM
Undefined reference to function error Quest101 Linux - Newbie 0 12-30-2004 05:01 PM
Need help with PHP and MySQL: Undefined function... Mega Man X Programming 12 09-15-2004 11:07 PM
undefined function: mysql_connect Greenman Programming 8 12-27-2003 05:35 AM
Glob(): Undefined Function? HappyDude Programming 0 11-05-2003 07:10 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 05:27 PM.

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