<br><br><div class="gmail_quote">On Wed, May 20, 2009 at 6:43 PM, Dan Yamins <span dir="ltr"><<a href="mailto:dyamins@gmail.com">dyamins@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi fontconfig list:<br><br>I'm having a problem with performance of the program "dot" (for
rendering graphs) when called from a python cgi script, served by an
apache virtual host. I'm using OSX 10.5.6 and graphviz2.22 (built via macports). When
I run a simple python script that calls dot (via a system call) to
render a small graph, it takes a normal (short) amount of time. But
when I run the same call via CGI script it takes roughly 100 times
longer. I wrote to the Apache and graphviz lists about this problem and got the following response:<br><br><blockquote type="cite">A hunch is that some cache is not seen or is not
available.
<br>
Could be the fontconfig cache. It could be the case that you
<br>
have a ~dyamins/.fontconfig but httpd is not able to create one
<br>
and there is no system cache.
<br>
</blockquote>This
seems precisely to be the problem. I do have a ~/.fontconfig directory
containing cache files. When I delete it, the performance of the
command line script is just as slow as the cgi script until the next
time the command is run (e.g. after the cache is remade). <br><br>So I
guess the question becomes: how do I get apache and the CGI script to
see and use the .fontconfig caches? I posted this question back to the apache list and got the following responses:<br><br>> On Mac OS X Apache runs as the user www, which does indeed have its shell set to /usr/bin/false so you can't log in to it.<br>
> Maybe there's an environment variable that can be set to tell
fontconfig to look for its caches somewhere else? You might need to ask
the fontconfig list about that.<br>
<br><br>>When you run your script (any script) as a cgi program under Apache, it runs under the user-id under which Apache itself runs.<br>
>That user-id may, or may not, have the same environment as when you run
the script from the command-line, under (presumbaly) your own user-id.<br>
>If the environment for your own user-id includes some environment
variables which need to be set to indicate to the script where to find
certain things<br>>What we Apache guys do not know, is what exactly your script needs as
an environment. That is off-topic here, and you must find this out in
the appropriate command documentation, or on some related help forum.<br><br><font color="#888888"></font></blockquote><div><br><br>The answer to this problem, by the way, is the "HOME" environment variable, containing the absolute path the user home directory. This environment variable was not being set in environment of the CGI script, but once it's set explicitly, the caches are seen and run fast. <br>
<br>This leads to my having the following question: if I want to set the cache directory explicitly (e.g. to use some shared cache area instead of the one in the user's directory), how would I do that? Is there some environment variable I can set other than "HOME" that fontconfig will recognize? <br>
<br>Thanks,<br>Dan<br><br><br></div></div><br>