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

[]PHP执行系统命令失败

WBOY
WBOYOriginal
2016-06-13 11:19:56870browse

[求助]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 />


<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 />


<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 />


<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 />


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

你这样写会把红色部分当成参数的(相当于一个错误的DOS命令),路径有空格要用引号
Statement:
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