[] PHP failed to execute system commands-php Tutorial

Source: Internet
Author: User
[Help] PHP failed to execute the System Command. This post was last edited by leonli908 from 2013-04-0810: 48: 18. the function is to convert the image format through an external program (none of these writing methods works, shell can be successful, but PHP returns 1, indicating that the statement is incorrect. exec (c: Program FilesIrfanViewi_view32.exe & nbsp [help] PHP failed to execute the System Command

This post was last edited by leonli908 at 10:48:18

Function: convert the image format by using an external program. (no write method is supported. you can use shell. However, if PHP returns 1, the statement is incorrect)

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



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



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



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


PS: security mode not enabled

PHP? Help? System commands


------ Solution --------------------
Grant the general user the execution permission to C: \ Program Files \ IrfanView> I _view32.exe
------ Solution --------------------
"C:/Program Files/IrfanView/I _view32.exe

In this case, the red part is used as the parameter (equivalent to an incorrect doscommand), and the path contains spaces to use quotation marks.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.