LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   php5 compile woes: undefined function imagettftext (https://www.linuxquestions.org/questions/slackware-14/php5-compile-woes-undefined-function-imagettftext-406727/)

BCarey 01-22-2006 09:08 PM

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

irpstrcr 01-22-2006 09:22 PM

A quick guess would be php looking for libfreetype in the wrong place.

BCarey 01-22-2006 09:35 PM

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

irpstrcr 01-22-2006 09:46 PM

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

BCarey 01-22-2006 09:54 PM

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

abbnam 05-18-2007 11:42 PM

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.


All times are GMT -5. The time now is 12:53 AM.