Different results through SSH and PHP's passthru (rsvg-convert)

I’m using rsvg-convert to convert an SVG file to a PDF file. If I run it from SSH from the prompt it converts the file correctly.

However if I run it from within PHP with passthru or exec it doesn’t convert the fonts properly.
[php]passthru("~/bin/rsvg-convert ~/example.com/designs/splitf.svg -f pdf -o ~/example.com/designs/splitf2.pdf");[/php]

I’ve copied the fonts used by the SVG file to ~/.fonts. As SSH is only really usefull for testing, is there anyway to get the fonts included correctly from within the PHP call (or should I place the fonts somewhere else maybe)?

Any help would be appreciated.

Have you tried using absolute paths rather than relative ones?

Thanks for the suggestion, I had tried that and there is no difference. I think it must be in a config file somewhere.

If I run fc-list from SSH I get a longer list of fonts (including the ones I copied to ~/.fonts) then from the same command through PHP passthru (which missing the fonts I copied). I think I will need to find a way to include a custom local.conf font file, but no luck so far.

Ended up getting some help from dreamhost support. You need to call the correct environment calls to set the home and user folders:

putenv(‘HOME=/home/yourfolder’);
putenv(‘USER=yourusername’);
system(“fc-list”);

Happy happy joy joy, check out http://www.vanvanvans.com/designer for the end result (and note the ‘official’ UK numberplate font)