Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Slackware 10.2 , PHP and Freetype

46 views
Skip to first unread message

Rob Steinmetz

unread,
Dec 23, 2005, 11:23:49 AM12/23/05
to
I have been working on installing an application which uses Apache PHP
and Mysql on 10.2. Most everything works fine out of the box but some
functions fail because apparently Freetype is not compiled into the PHP
package provided with Slack.

I was wondering if there is a reason for this. Freetype usually goes
with the GD libraries in PHP. It would be great if there is a availible
package for Slackware which does have it already in there.

Apparently installing Freetype requires reconfiguring and recompiling
Apache and PHP, which will in turn requires some other source packages
be included which will require me to install the Slackware source.
Something simpler would be appreciated.

If I do have to compile it, where does Slack store the TTF fonts for the
compile option "--with-freetype-dir=???????"

--
Robert Steinmetz
Principal
Steinmetz & Associates

Thomas Ronayne

unread,
Dec 23, 2005, 12:00:03 PM12/23/05
to
Rob Steinmetz wrote:
> If I do have to compile it, where does Slack store the TTF fonts for
> the compile option "--with-freetype-dir=???????"
If you're just missing TTFs, you don't need to build anything, you just
need to install the fonts -- here's a guide from a while back that shows
how to do that:

Assuming you have a bunch of TTF font files (from wherever you got
them), it's pretty easy:

log in as root (or su or whatever)
cd directory-where-TTF-files-are
# create the target directory if it doesn't already exist
mkdir -p /usr/X11R6/lib/X11/fonts/TTF
# copy all the TTF files, changing the name to lower case as you go
for file in *.[Tt][Tt][Ff]
do
cp ${file} /usr/X11R6/lib/X11/fonts/TTF/`echo ${file} | tr [A-Z]
[a-z]`
done
# go to the directory you just copied all that stuff to
cd /usr/X11R6/lib/X11/fonts/TTF
# if you got them from winders, change the mode of the files
chmod 644 *
# create the fonts.dir and fonts.scale files you need
mkfontdir
mkfontscale
# you should have files fonts.dir and fonts.scale, look at 'em if
you want

Now you need to add the font path to /etc/X11/xorg.conf; in the section
"Files," add this line:

FontPath "/usr/X11R6/lib/X11/fonts/TTF/"

That section of my xorg.conf file looks like this:

Section "Files"
RgbPath "/usr/X11R6/lib/X11/rgb"
ModulePath "/usr/X11R6/lib/modules"
FontPath "/usr/X11R6/lib/X11/fonts/misc/"
FontPath "/usr/X11R6/lib/X11/fonts/TTF/"
FontPath "/usr/X11R6/lib/X11/fonts/Type1/"
# FontPath "/usr/X11R6/lib/X11/fonts/CID/"
FontPath "/usr/X11R6/lib/X11/fonts/75dpi/"
FontPath "/usr/X11R6/lib/X11/fonts/100dpi/"
EndSection

You need to exit from X (if it's running) and execute

fc-cache /usr/X11R6/lib/X11/fonts/TTF

Then restart X.

That's it.

If you need to compile PHP, that's another matter but I can't imagine
why you would have to -- with the fonts installed as above, PHP works
just fine.

Hope this helps some.

--
Everything works -- if you let it.

Doogster

unread,
Dec 23, 2005, 12:32:08 PM12/23/05
to
On 2005-12-23, Thomas Ronayne <tr...@REMOVETHISameritech.net> wrote:

> Assuming you have a bunch of TTF font files (from wherever you got
> them), it's pretty easy:

> [put the .ttfs into one directory, convert the names to lowercase]
> [then...]


> Now you need to add the font path to /etc/X11/xorg.conf; in the section
> "Files," add this line:
>
> FontPath "/usr/X11R6/lib/X11/fonts/TTF/"
>

> You need to exit from X (if it's running) and execute
>
> fc-cache /usr/X11R6/lib/X11/fonts/TTF
>
> Then restart X.

I'd like to revise that.

After adding the FontPath to his xorg.conf, he only needs to restart X
--no need to use fc-cache -- before he'll see the new fonts in xfontsel
and xlsfonts and other programs that index fonts seen by X.

However, he also needs to add the fonts to the fontconfig system that
feeds fonts to gtk2 and qt application. To do this he needs to add the
new font path to /etc/fonts/local.conf. If this is his first time doing
this, then he will copy /etc/fonts/fonts.conf to /etc/fonts/local.conf,
open local.conf in his text editor, delete everything between the
<fontconfig> and </fontconfig> tags, and then write in that place a
single line:

<dir>/usr/X11R6/lib/X11/fonts/TTF/</dir>

Then he needs to run, as root,

/usr/X11R6/bin/fc-cache -f -v

He doesn't need to exit X before doing this, and he should see the
changes immediately. In particular, fc-cache should mention the new font
path and he should also see the font listed when he types fc-list.

Doogster

unread,
Dec 23, 2005, 1:00:48 PM12/23/05
to
On 2005-12-23, Rob Steinmetz <rstei...@not-mindspring.com> wrote:

> If I do have to compile it, where does Slack store the TTF fonts for the
> compile option "--with-freetype-dir=???????"

/usr/include/freetype2

The --with-freetype-dir option needs the include files, not the fonts.

Damjan

unread,
Dec 23, 2005, 1:00:44 PM12/23/05
to
It's been a while since I've used the default apache and PHP in
Slackware.
I ussualy upgrade to apache-2.0 and I compile PHP with it too... but
I'll try to help you.

First of all, what exactly is your problem?

Second, looking at the PHP slackbuild, I see:
--with-gd \
--enable-gd-native-ttf \
--with-jpeg-dir=/usr \
--with-png \
--with-gmp \
This means it should have ttf support.

Third, --with-freetype-dir= has nothing to do with fonts, but with the
base dir of the freetype library.
Freetype in Slackware is part of the x11 package and it's base dir is
/usr/X11R6, but I ussualy make my own freetype package that installs in
/usr.

So, once again what exactly is your problem?

Thomas Ronayne

unread,
Dec 23, 2005, 1:06:12 PM12/23/05
to
Funny thing -- I've never, ever, done any of that and
/etc/fonts/fonts.conf is perfectly well aware of the TTF directory; the
entry is
<!-- Font directory list configured on Sun Sep 25 17:37:02 PDT 2005 -->

<dir>/usr/share/fonts</dir>
<dir>/usr/X11R6/lib/X11/fonts/TTF</dir>
<dir>/usr/X11R6/lib/X11/fonts/Type1</dir>
<dir>~/.fonts</dir>
And that would be just about the date I installed the TTF files as
described. And, oh, by the way, when I restarted X, everybody that
needed to know about TTF fonts found 'em just fine.

So, I dunno about all this other stuff, but I do know that I've never
done it and...

No_One

unread,
Dec 23, 2005, 1:49:42 PM12/23/05
to

To add to it....

making a web page with phpinfo() will give the op all the info they should
need...

<?
phpinfo();
?>

ken

Rob Steinmetz

unread,
Dec 23, 2005, 1:47:22 PM12/23/05
to

When the application (eGroupware) runs I get this error in
/var/log/apache/error_log;

PHP Fatal error: Call to undefined function: imagettfbbox()in
/.../jpgraph.php on line 3029.

This looks to me like the PHP library which includes "imagettfbbox()" is
missing. This was confirmed by others familiar with the application. It
seemed more like a Slackware configuration issue so here I am.

Based on the PHP documentation this seems to be caused by the lack of
Freetype support in PHP. As I understand it this support needs the
"--with-freetype-dir=" option in the PHP configuration. I checked the
Slack provided PHP and it seems to be missing both in the SlackBuild
script and in the binary.

Since the gd support was included I was wondering how to add whatever is
missing. If fonts were missing as others suggested I would have expected
a different error, something like;

"Font fontname.ttf Not Found"

Since I am not familiar with PHP I am learning as I go along.

If I understood your comment above I would need to add the following to
the SlackBuild script for php;

"--with-freetype-dir=/usr/X11R6"

For maintainability I would like to make as few changes in the standard
SlackWare packages as practical.

In any event this is a test and evaluation installation so I want to get
it running as simply as possible and then make whatever modification are
necessary and appropriate.

Thank you for the information it is helpful and I appreciate your
willingness to help. I am also considering upgrading some of the pieces,
but only if we decide the application meets our needs.

No_One

unread,
Dec 23, 2005, 2:16:09 PM12/23/05
to
On 2005-12-23, Rob Steinmetz <rstei...@not-mindspring.com> wrote:
>
> When the application (eGroupware) runs I get this error in
> /var/log/apache/error_log;
>
> PHP Fatal error: Call to undefined function: imagettfbbox()in
> /.../jpgraph.php on line 3029.
>
> This looks to me like the PHP library which includes "imagettfbbox()" is
> missing. This was confirmed by others familiar with the application. It
> seemed more like a Slackware configuration issue so here I am.

This function has been a part of php for some time....here's a quick, dirty
and unprofessional way to see if the function is compiled in


write a plain text file called test.php

<?php
imagettfbbox();
?>

Save it and run it from the command line

php test.php

You'll get an error message, if it says unknown function it's not compiled
in, if it says wrong parameter count it's compiled in.

Like I said, not very professional, but it works.

ken

Rob Steinmetz

unread,
Dec 23, 2005, 2:33:07 PM12/23/05
to
No_One wrote:

> This function has been a part of php for some time....here's a quick, dirty
> and unprofessional way to see if the function is compiled in
>
>
> write a plain text file called test.php
>
> <?php
> imagettfbbox();
> ?>
>
> Save it and run it from the command line
>
> php test.php
>
> You'll get an error message, if it says unknown function it's not compiled
> in, if it says wrong parameter count it's compiled in.
>
> Like I said, not very professional, but it works.
>
> ken

I get the same error message I reported above, which indicates its not
compiled in.

PHP Fatal error: Call to undefined function: imagettfbbox()in
/.../jpgraph.php on line 3029.

So I need to recompile php, with some additional option(s), can you
confirm what those options are?

phpinfo reports the following options;

System => Linux electra 2.4.31 #6 Sun Jun 5 19:04:47 PDT 2005 i586
Build Date => Sep 4 2005 20:23:31
Configure Command => './configure'
'--prefix=/usr'
'--enable-force-cgi-redirect'
'--enable-fastcgi'
'--enable-pcntl'
'--enable-sigchild'
'--sysconfdir=/etc'
'--enable-discard-path'
'--with-config-file-path=/etc/apache'
'--enable-safe-mode'
'--with-openssl'
'--with-mhash'
'--enable-bcmath'
'--with-bz2'
'--with-pic'
'--enable-calendar'
'--enable-ctype'
'--with-gdbm'
'--with-db3'
'--with-imap-ssl=/usr/local/lib/c-client'
'--with-imap=/usr/local/lib/c-client'
'--enable-dbase'
'--enable-ftp'
'--with-iconv'
'--with-dom'
'--with-exif'
'--enable-exif'
'--with-gd'
'--enable-gd-native-ttf'
'--with-jpeg-dir=/usr'
'--with-png'
'--with-gmp'
'--enable-mbstring'
'--with-curl=/usr'
'--with-pcre-regex=/usr'
'--with-mysql=shared,/usr'
'--with-gettext=shared,/usr'
'--with-expat-dir=/usr'
'--with-xml'
'--enable-wddx'
'--with-mm=/usr'
'--enable-trans-sid'
'--enable-shmop'
'--enable-sockets'
'--with-regex=php'
'--enable-sysvsem'
'--enable-sysvshm'
'--enable-yp'
'--enable-memory-limit'
'--with-tsrm-pthreads'
'--enable-shared'
'--disable-debug'
'--with-zlib=/usr'

This is the version of PHP which came with Slackware.

Based on my other research, I think I need at least;

"--with-freetype-dir=/usr/X11R6"

I'd also be interested in know if there is a reason it's not there already.

Rob Steinmetz

unread,
Dec 23, 2005, 3:00:56 PM12/23/05
to
Rob Steinmetz wrote:

>
> Based on my other research, I think I need at least;
>
> "--with-freetype-dir=/usr/X11R6"
>
> I'd also be interested in know if there is a reason it's not there already.
>

I just reread this thread and noticed that someone suggested I needed;

"--with-freetype-dir=/usr/include/freetype2"

Which is correct and why isn't it in there already?

Melissa Danforth

unread,
Dec 23, 2005, 4:34:57 PM12/23/05
to
Thomas Ronayne <tr...@removethisameritech.net> wrote:
: Funny thing -- I've never, ever, done any of that and
: /etc/fonts/fonts.conf is perfectly well aware of the TTF directory; the
: entry is

Using local.conf is "the way" to do it, but using fonts.conf works. The
motivation behind using local.conf is that local.conf will not be overwritten
by fontconfig while fonts.conf will be. This is in the header information for
fonts.conf.

No_One

unread,
Dec 23, 2005, 4:57:50 PM12/23/05
to

On 2005-12-23, Rob Steinmetz <rstei...@not-mindspring.com> wrote:
> No_One wrote:
>
>> This function has been a part of php for some time....here's a quick, dirty
>> and unprofessional way to see if the function is compiled in
>>
>>
>> write a plain text file called test.php
>>
>> <?php
>> imagettfbbox();
>> ?>
>>
>> Save it and run it from the command line
>>
>> php test.php

> I get the same error message I reported above, which indicates its not

> compiled in.
>
> PHP Fatal error: Call to undefined function: imagettfbbox()in
> /.../jpgraph.php on line 3029.

> '--with-gd'
> '--enable-gd-native-ttf'

NO...if the program is reporting that the function does not exist and
phpinfo indicates that the gd lib is compile in then the problem is unlikely
to be with php....you may not have the gd lib installed on your machine or
some other lib.

the gd functions require a number of libraries to work with various images ,
in fact, not having xpm enabled and specified with a path can cause a problem.

First, you need to go back to the orginal php program, re-read the install
info and make sure you have a complete list of all lib, modules etc you
need. You may be missing something small or something large. Remember, PHP
was never orginally designed to handle graphics and ttf is, in a way,
graphics. Stop at the web site for hints.

After that...go to the php manual on image manipulation and make sure all
the type fonts are set and the required modules are available.

You probably do not have to recompile php....that should be a last resort.

I've been using php for half a dozen years and have yet to use an image
function...so, I'm limited...

ken


Thomas Ronayne

unread,
Dec 23, 2005, 5:30:14 PM12/23/05
to
I've always installed fonts with the idea in mind that they're
system-wide (comes from 20+ years with Unix, I suppose) and thus
available to any application that requires access to them. For that
reason, I never mess with "local" fonts or bothering with font lists in
individual user directories (and honest! I've never had to). I mean,
after all, why bother otherwise?

Melissa Danforth

unread,
Dec 23, 2005, 9:34:17 PM12/23/05
to
Thomas Ronayne <tr...@removethisameritech.net> wrote:
: I've always installed fonts with the idea in mind that they're
: system-wide (comes from 20+ years with Unix, I suppose) and thus
: available to any application that requires access to them. For that
: reason, I never mess with "local" fonts or bothering with font lists in
: individual user directories (and honest! I've never had to). I mean,
: after all, why bother otherwise?

Ah, you're suffering from a semantics issue. I'm assuming from how you phrased
it that you see any "local" file as not affecting everyone on the system. From
my understanding, fontconfig sees /etc/fonts/local.conf as those configurations
that are specific to the local machine, ie anything that changes from the base
installation configuration. It will affect everyone if the configs are put in
that file. Different semantics for the intent of "local".

Rob Steinmetz

unread,
Dec 24, 2005, 10:46:12 AM12/24/05
to
I ran PHPinfo and got this from

GD

GD Support enabled
GD Version bundled (2.0.28 compatible)
GIF Read Support enabled
GIF Create Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
XBM Support enabled

On some other examples I have seen there are entries indicating that
Freetype is enabled. I don't see that on my report. All of the
information I see at PHP.org is that I need to recompile PHP and
possibly mod_php and maybe apache to get everything in sync.


I'm going to try modifing phpSlackBuild and see what happens whne I
install the package

Rob Steinmetz

unread,
Dec 24, 2005, 11:59:22 AM12/24/05
to
Rob Steinmetz wrote:

>
> I'm going to try modifing php.SlackBuild and see what happens whne I
> install the package
>

I've modified the php.SlackBuild script and added only following;

"--with-freetype-dir=/usr/include/freetype2 \"

to the configure options after the other gd options.

The SlackBuild script runs with only a few warnings and build all of the
packages listed in the script.

Installation of my new package completes with out any error.

When I run phpinfo these options are added to the gd section;

FreeType Support enabled
FreeType Linkage with freetype

My application now works although I still need to add some PHP libraries.

FINALLY

Thank you to every who helped me understand. It would have taken much
longer without you.

I wonder why this option is not included in the standard Slack build?
Anyone out there know why?

I would like to recommend that freetype support be added to the standard
php build, since Slack emphasized the improvements in font handling in
recent versions. It seems natural to extend that since all of the parts
are already there.

Of course I may be missing something. There may be some significant
price to pay for this option.

Henrik Carlqvist

unread,
Dec 24, 2005, 3:51:04 PM12/24/05
to
> I've modified the php.SlackBuild script and added only following;
>
> "--with-freetype-dir=/usr/include/freetype2 \"

> I wonder why this option is not included in the standard Slack build?


> Anyone out there know why?

I can only guess, but my guess is that the files in /usr/include/freetype2
comes from a package which belongs to the X server (X.org). If you install
a machine that is only supposed to be a web server you want apache, php
and some other stuff. But on such a server you probably don't want kde,
gnome or even an X server. So you wouldn't want a php package that depends
on a big X server package.

If I keep guessing my guesses are that this will change in the future when
Slackware comes with X11R7.0. One of the big improvements in 7.0 is that
it is modularized and by default assumes that freetype is a standalone
library.

regards Henrik
--
The address in the header is only to prevent spam. My real address is:
hc7(at)uthyres.com Examples of addresses which go to spammers:
ro...@variousus.net root@localhost

Thomas Ronayne

unread,
Dec 24, 2005, 5:49:30 PM12/24/05
to
Henrik Carlqvist wrote:
> I can only guess, but my guess is that the files in /usr/include/freetype2
> comes from a package which belongs to the X server (X.org). If you install
> a machine that is only supposed to be a web server you want apache, php
> and some other stuff. But on such a server you probably don't want kde,
> gnome or even an X server. So you wouldn't want a php package that depends
> on a big X server package.
>
Good guess -- freetype is installed with the X11 packages in Slackware.

> If I keep guessing my guesses are that this will change in the future when
> Slackware comes with X11R7.0. One of the big improvements in 7.0 is that
> it is modularized and by default assumes that freetype is a standalone
> library.
>
Another good guess -- freetype-2.1.9 is included in the source extras
directory in X11R7.0 (but it's also included in the X11R6.9 source, so
there you are). From what X.org is telling me, X11R7.0 is the same as
X11R6.9 but is modular instead of "World." I suppose whether or not
freetype is installed is up to Mr. Slackware, eh.
> regards Henrik
>
Merry, merry, happy, happy.

Ron Gibson

unread,
Dec 27, 2005, 5:03:07 PM12/27/05
to
On Fri, 23 Dec 2005 18:00:48 +0000, Doogster wrote:

>> If I do have to compile it, where does Slack store the TTF fonts for the
>> compile option "--with-freetype-dir=???????"

> /usr/include/freetype2

> The --with-freetype-dir option needs the include files, not the fonts.

If you want to do a little more you can also recompile freetype with
the bytecode enabled and perhaps use another font server.

I get the best results recompiling and using xfstt for my font server.

Ron Gibson

unread,
Dec 27, 2005, 5:27:37 PM12/27/05
to
On Fri, 23 Dec 2005 13:47:22 -0500, Rob Steinmetz wrote:

>> base dir of the freetype library.
>> Freetype in Slackware is part of the x11 package and it's base dir is
>> /usr/X11R6, but I ussualy make my own freetype package that installs in
>> /usr.

> "Font fontname.ttf Not Found"



> If I understood your comment above I would need to add the following
> to the SlackBuild script for php;

> "--with-freetype-dir=/usr/X11R6"

> For maintainability I would like to make as few changes in the standard
> SlackWare packages as practical.

Actually there may exist more than one libfreetype installed...

locate libfreetype

/usr/lib/libfreetype.so.6.3.7
/usr/lib/libfreetype.so.6
/usr/lib/libfreetype.la
/usr/lib/libfreetype.so
/usr/lib/libfreetype.a

The above comes with all Slack - However I recompiled these

/usr/X11R6/lib/modules/fonts/libfreetype.so

This is the version that comes with X, and is used as a module

/usr/X11R6/lib/libfreetype.so

Older X versions had this. I added it to my system as a link to my
recompiled version.

/oofice/program/filter/libfreetype.so.6

That came with OOffice.

The below is from the libfreetype source freetype/docs/UPGRADE.UNX
(Also explains the bytecode hinting issue)

Certain recent Linux distributions will install _several_ versions of
FreeType on your system. For example, on a fresh Mandrake 8.1
system, you can find the following files:

/usr/lib/libfreetype.so which links to
/usr/lib/libfreetype.6.1.0.so

and

/usr/X11R6/lib/libfreetype.so which links to
/usr/X11R6/lib/libfreetype.6.0.so

Note that these files correspond to two distinct versions of the
library! It seems that this surprising issue is due to the install
scripts of recent XFree86 servers (from 4.1.0) which install their
own (dated) version of the library in "/usr/X11R6/lib".

In certain _rare_ cases you may experience minor problems if
you install this release of the library in "/usr" only, namely,
that certain applications will not benefit from the bug fixes
and rendering improvements you would expect.
----------------------------------------------------------

For 2-3 years now first thing I do is recompile and install libfreetype
(enabling hinting). I take additional steps but that step alone gives
better font rendering. I also use xfstt. Also I tweak /etc/X11/fs/conf
and xorg.conf. Depending on the distro the results vary. In some cases
it is a dramatic improvement. I've never had a problem with it.

Ron Gibson

unread,
Dec 27, 2005, 6:04:11 PM12/27/05
to
On Fri, 23 Dec 2005 14:33:07 -0500, Rob Steinmetz wrote:

> This is the version of PHP which came with Slackware.

> Based on my other research, I think I need at least;

> "--with-freetype-dir=/usr/X11R6"

Actually unless you are using an old version of Slackware only a X
module is under the X11R6 tree.

Try

locate libfreetype

or

freetype-config --prefix

to see where yours is. On my versions of 10.1 and 10.2 using /usr/XllR6
would not be what you want to do. Freetype (libfreetype) is in /usr/lib
not /usr/X11R6/lib

0 new messages