[Help] PHP failed to execute system commands

Source: Internet
Author: User
[Help] PHP failed to execute the system command function: convert the image format by using an external program (none of the writing methods can be done by using shell, but 1 is returned through PHP, indicating that the writing 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


Reply to discussion (solution)

Is this I _view32.exe running in the system interface?

Is this I _view32.exe running in the system interface?
Run the interface directly. if you convert the format, the interface should not appear when calling the command.

PS: IrfanView is a powerful and free image View software. Previously, the JAVA version of the program can be executed, but it won't work if it is changed to PHP.

It's just a command call. There should be no interface ???
No, it should be!
Run the command in the command window. if there is no problem, paste the command.

An error occurred while expressing the message. Are you sure you have no interface or pop-up window:
C: \ Program Files \ IrfanView> I _view32.exe c: \ Program Files \ IrfanView \ 03280009.sff/convert = c: \ Program Files \ IrfanView \ 4.tif

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

"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.

Grant the general user the execution permission to C: \ Program Files \ IrfanView> I _view32.exe
I have seen this suggestion before, but the right-click attribute does not see this authorization. what should I do?

"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.
There is indeed a space problem, but after I adjusted the path, I kept waiting for the execution. it seems that it is stuck. do you still need to authorize it.

Succeeded:
1. the path cannot contain spaces. for example, special processing is required for spaces;
2. correct syntax: exec ("c :\\ IrfanView \ I _view32.exe c :\\ IrfanView \ 03280009.sff/convert = c :\\ IrfanView \ 4.tif", $ result, $ status );

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.