1

I am trying to execute the following command via PHP's exec function:

D:\\pstill -F a4 -2 -c -c -c -c -g -i -t -K -d 700 -a 4 -m XimgAsCMYK -m Xspot -m Xoverprint -o D:\\outputfile.pdf D:\\new.jpg  

It doesn't generate any output. But if I directly paste the command on the command line then it works...

Note: it takes a bit of time to complete when run directly on command line.

3
  • Do you receive any error message? Could you please tell us your code (not only the command you are executing)? Commented Jan 16, 2012 at 13:31
  • exec("pstill -F a4 -2 -c -c -c -c -g -i -t -K -d 700 -a 4 -m XimgAsCMYK -m Xspot -m Xoverprint -o D:\\outputfile.pdf D:\\input.jpg"); Commented Jan 16, 2012 at 13:34
  • Make sure that your webserver's userid has the appropriate permissions to execute pstill, and read/write permissions on the D:\ root directory/drive. Commented Jan 16, 2012 at 14:17

3 Answers 3

5

I would suggest using shell_exec instead of exec function here. shell_exec executes command via appropriate shell (WIndows / Unix etc) and returns the complete output as a string to you.

Sign up to request clarification or add additional context in comments.

Comments

4

If your command is this:

exec("pstill -F a4 -2 -c -c -c -c -g -i -t -K -d 700 -a 4 -m XimgAsCMYK -m Xspot -m Xoverprint -o D:\\outputfile.pdf D:\\input.jpg");

PHP escapes the backslashes, so the command that reaches the shell is ... D:\outputfile.pdf D:\input.jpg. You have to double-escape the backslashes: once for PHP and once for the shell.

exec("pstill -F a4 -2 -c -c -c -c -g -i -t -K -d 700 -a 4 -m XimgAsCMYK -m Xspot -m Xoverprint -o D:\\\\outputfile.pdf D:\\\\input.jpg");

Comments

0

for me the solution was to

run apache in a terminal window instead of a service.

see this thread: apache service php exec not working

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.