Slow Font access under apache
Posted: 2010-01-03T18:51:56-07:00
I had posted this message on the main user board without any response. I'm hoping someone on this board may have an idea where to point me in the right direction.
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 rather than a manual install 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 to run using the command line, but the same script run as a web page takes over 26 seconds.
The following script:
<?php
exec("convert -list");
?>
takes less than 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 call under php/apache 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
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 rather than a manual install 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 to run using the command line, but the same script run as a web page takes over 26 seconds.
The following script:
<?php
exec("convert -list");
?>
takes less than 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 call under php/apache 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