Slow Font access in apache
Posted: 2009-12-21T13:41:43-07:00
I have a php page that processes a large text file and draws an image using ImageMagick. A long text command is generated and then exec(cmd) is used to do the drawing. It works like a charm, but recently the processing slowed to a crawl. This was following a new laptop, new mac operating system, different ImageMagick version and using macports to install ImageMagick so I can't say what coincided with the problem appearing. After a while I tracked down the problem to any use of text fonts. A minimal example is shown in the following php script
<?php
exec ("convert -list font");
?>
takes less that 0.5 seconds using the command line, but running the same script via a web page takes over 26 seconds.
The following script
<?php
exec("convert -list");
?>
takes less that 0.02 seconds on the command line or on the web page.
Any use of draw or annotate suffers the same slowdown.
I presume that the system environment for apache differs from a command-line login environment as a specific user and that for some reason it is taking the apache call for ever to locate available fonts. I've looked everywhere for a clue for how to setup the apache system environment and how my login environment differs from the apache environment but with no luck so far.
Any ideas?
Mac OSX 10.6.2,
macports
ImageMagick vesion 6.5.6-1_0
Built-in apache-2.0 server
<?php
exec ("convert -list font");
?>
takes less that 0.5 seconds using the command line, but running the same script via a web page takes over 26 seconds.
The following script
<?php
exec("convert -list");
?>
takes less that 0.02 seconds on the command line or on the web page.
Any use of draw or annotate suffers the same slowdown.
I presume that the system environment for apache differs from a command-line login environment as a specific user and that for some reason it is taking the apache call for ever to locate available fonts. I've looked everywhere for a clue for how to setup the apache system environment and how my login environment differs from the apache environment but with no luck so far.
Any ideas?
Mac OSX 10.6.2,
macports
ImageMagick vesion 6.5.6-1_0
Built-in apache-2.0 server