0

I am working on a project that involves PDF API TCPDF. So I needed an area in admin where site admin can upload and install new fonts to be used with TCPDF. I am working on a script that does following : 1) upload TTF font to TCPDF fonts/utils/ directory. 2) execute ttf2afm from PHP script and create .AFM (adobe font metrics)

$command = escapeshellarg("/usr/bin/ttf2afm $fontPath$fontName -o $fontPath$afmName");
$result = passthru($command);

or

$command = escapeshellarg("ttf2afm $fontPath$fontName -o $fontPath$afmName");
$result = passthru($command);

3) execute php -f makefont.php font.ttf font.afm and generate the required font.php and font.z files.

now my problem is, the above commands are not executing from web page. If I copy and execute part of this code from php interactive shell it works well. But, from webpage, it simply does not work...

Is there some permission related problem? or I can not execute such commands from a web page?

Thanks in advance

Ravish
  • 2,383
  • 4
  • 37
  • 55

1 Answers1

0

First, escapeshellarg is used wrong. Better is:

$command = escapeshellcmd("/usr/bin/ttf2afm")." ".escapeshellarg($fontPath.$fontName)." -o ".escapeshellarg($fontPath.$afmName);

Also make sure that error logging is enabled, so you can see if there is a permission error.

dog
  • 390
  • 2
  • 8
  • thanks a lot that worked and that was problem with most of the commands I was trying to execute from my script... – Ravish Jun 27 '11 at 10:41