无法从 php 执行 ttf2afm
我正在开发一个涉及 PDF API TCPDF 的项目。因此,我需要在管理中设置一个区域,站点管理员可以在其中上传和安装与 TCPDF 一起使用的新字体。 我正在编写一个执行以下操作的脚本: 1) 将 TTF 字体上传到 TCPDF fonts/utils/ 目录。 2) 从 PHP 脚本执行 ttf2afm 并创建 .AFM(adobe 字体规格)
$command = escapeshellarg("/usr/bin/ttf2afm $fontPath$fontName -o $fontPath$afmName");
$result = passthru($command);
或
$command = escapeshellarg("ttf2afm $fontPath$fontName -o $fontPath$afmName");
$result = passthru($command);
3) 执行 php -f makefont.php font.ttf font.afm 并生成所需的 font.php 和 font.z文件。
现在我的问题是,上述命令没有从网页执行。如果我从 php 交互式 shell 复制并执行部分代码,它会很好地工作。但是,从网页来看,它根本不起作用......
是否存在一些与权限相关的问题?或者我无法从网页执行此类命令?
提前致谢
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,escapeshellarg使用错误。更好的是:
还要确保启用错误日志记录,以便您可以查看是否存在权限错误。
First, escapeshellarg is used wrong. Better is:
Also make sure that error logging is enabled, so you can see if there is a permission error.