从php exec或shell_exec运行java jar不适用于蜡染 [英] running java jar from php exec or shell_exec isnt working for batik
问题描述
我正在尝试
exec(java -jar "C:\batik\batik-rasterizer.jar" -m image/png -d
"C:/pathtoimg/temp/2fa8af078803491746235057c546c1b6.png" -w 800
"C:/pathtoimg/temp/2fa8af078803491746235057c546c1b6.svg");
它没有给我任何结果可以有人建议我做错了什么。
it's not giving me any results can anybody suggest what am i doing wrong.
机器是windows 2008 R2企业
iis 7
with fastcgi
machine is windows 2008 R2 enterprise iis 7 with fastcgi
exec('java -version')
exec('java -version')
推荐答案
您的计算机是否已关闭UAC? (Windows 7或Vista,访问C:没有UAC权限会出错,所以为了方便关闭它),
Does your computer have UAC turned off? (Windows 7 or Vista, accessing C: with out UAC perms will error so for ease turn it off),
其次,exec需要一个字符串输入,
Secondly, exec requires a string input,
第三个\需要转发,因为Phill说
Thirdly \ need to be escaped as Phill said
exec('java -jar "C:/batik/batik-rasterizer.jar" -m C:/pathto/image/png -d
"C:/pathtoimg/temp/2fa8af078803491746235057c546c1b6.png" -w 800
"C:/pathtoimg/temp/2fa8af078803491746235057c546c1b6.svg"');
对PHILLS的评论更新
使用CLI检查您是否允许使用exec / system / backticks
Check that your allowed to use exec/system/backticks, using the CLI
- 使用<$创建一个php文件c $ c><?php exec(echo hello); ?> 里面保存它
- 然后启动CMD,
- 打开一个新窗口(打开我的/计算机)并浏览到你的php.exe应用程序
- 复制你找到它的文件夹的地址
- 在cmd类型cd中没有引号和之后右键单击并单击pase然后按Enter键
- 键入php(再次没有引号)拖动保存到cmd框中的php文件并将其删除
- 然后点击回车,看看它是否在cmd框中显示hello
- Create a php file with
<?php exec("echo hello"); ?>
inside it save it - Then start CMD,
- open a new window (open up my/ computer) and browse to your php.exe application
- copy the address of the folder where you found it
- in cmd type "cd " without quotes and after that right click and click pase then hit enter
- type "php " (again without quotes) drag php file saved to the cmd box and drop it
- then hit enter and see if it says hello in the cmd box
如果这不起作用,请检查java是否正在运行而没有路径exe,在cmd窗口中键入你的 java --help
并查看它是否有效
if this does not work check java is working without path to exe, in the cmd windows type your java --help
and see if it works
这篇关于从php exec或shell_exec运行java jar不适用于蜡染的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!