0

I am working on Windows server and able to run command from command prompt

c:> %convertxls% {some args....}   

But when I run same command from php script

*shell_exec(%convertxls% ..... 2>&1);*

it gives me error as

%convertxls% is not recognized as an internal or external command, operable program or batch file.

I think when I am running command from command prompt, it run for user which logged in. And when I run the php script it run for "www" user for which path is not set.

Can anybody tell me where I am doing mistake?

*Note: I haven't written complete command.

1
  • Is that literally what you pass to shell_exec? Commented Jul 19, 2010 at 8:57

3 Answers 3

1

Supply the full path to the executable.

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

Comments

0

ignacio right,I wanted to add one more point that ignacio did not specify .

Check the parameter disable_functions in the php.ini .

maybe this function is not allowed.

Comments

0

This sounds like the environment variable %convertxls% is not set.

You can use putenv() to set it; alternatively, as Ignacio already says, specify the full path.

3 Comments

Thanks I have set convertxls using putenv() and its working correctly. But when I am using full path its not working and gives error 'C:/Program' is not recognized as an internal or external command, operable program or batch file. Any ways My work is done thanks once again.
@Kamlesh You need to set the path in quotes. "C:\Program Files\..."
note you might want to use single quotes not double quotes as using doubles means the backslash will be used a delimiter and lead to confusing errors

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.