Home > Backend Development > PHP Tutorial > []PHP执行系统命令失败

[]PHP执行系统命令失败

WBOY
Release: 2016-06-13 12:49:35
Original
889 people have browsed it

[求助]PHP执行系统命令失败

本帖最后由 leonli908 于 2013-04-08 10:48:18 编辑 功能:通过外部程序转换图片格式(几种写法都不行,通过shell可以成功,但通过PHP返回1,说明写法有误)
<br />
exec("c:/Program Files/IrfanView/i_view32.exe c:/Program Files/IrfanView/03280009.sff /convert=c:/Program Files/IrfanView/4.tif", $result, $status); <br />
echo $status;<br />
Copy after login


<br />
exec("c://Program Files//IrfanView//i_view32.exe c://Program Files//IrfanView//03280009.sff /convert=c://Program Files//IrfanView//4.tif", $result, $status); <br />
echo $status;<br />
Copy after login


<br />
exec("c:\Program Files\IrfanView\i_view32.exe c:\Program Files\IrfanView\03280009.sff /convert=c:\Program Files\IrfanView\4.tif", $result, $status); <br />
echo $status;<br />
Copy after login


<br />
exec("c:\\Program Files\\IrfanView\\i_view32.exe c:\\Program Files\\IrfanView\\03280009.sff /convert=c:\\Program Files\\IrfanView\\4.tif", $result, $status); <br />
echo $status;<br />
Copy after login


PS:未开启安全模式
PHP?求助?系统命令
------解决方案--------------------
给 C:\Program Files\IrfanView>i_view32.exe 赋予一般用户执行权
------解决方案--------------------
"c:/Program Files/IrfanView/i_view32.exe

你这样写会把红色部分当成参数的(相当于一个错误的DOS命令),路径有空格要用引号
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template