从php exec或shell_exec运行java jar不适用于蜡染 [英] running java jar from php exec or shell_exec isnt working for batik

查看:133
本文介绍了从php exec或shell_exec运行java jar不适用于蜡染的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试

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


  1. 使用<$创建一个php文件c $ c><?php exec(echo hello); ?> 里面保存它

  2. 然后启动CMD,

  3. 打开一个新窗口(打开我的/计算机)并浏览到你的php.exe应用程序

  4. 复制你找到它的文件夹的地址

  5. 在cmd类型cd中没有引号和之后右键单击并单击pase然后按Enter键

  6. 键入php(再次没有引号)拖动保存到cmd框中的php文件并将其删除

  7. 然后点击回车,看看它是否在cmd框中显示hello

  1. Create a php file with <?php exec("echo hello"); ?> inside it save it
  2. Then start CMD,
  3. open a new window (open up my/ computer) and browse to your php.exe application
  4. copy the address of the folder where you found it
  5. in cmd type "cd " without quotes and after that right click and click pase then hit enter
  6. type "php " (again without quotes) drag php file saved to the cmd box and drop it
  7. 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆