0

I have a java file and it will generate itunes report. I want to execute this within my php script. Im using the exec() function in php:it is working properly in linux.But not in windows.Am i missing anything?Any help will be appreciated.

exec("java Autoingestion ".'USERNAME'." '".'PASSWORD'."' ".'VENDORID'." ".'REPORT_TYPE'." ".'DATE_TYPE'." ".'REPORT_SUB_TYPE'." ".'2012-05-28'."",$output,$return);
3
  • Can you give a try using shell_exec command ? Also let us know if you getting anything in $output ? Commented Apr 20, 2013 at 8:48
  • The string concatenation looks a little iffy. Try to echo it before throwing it in exec, and make sure it does what you think it does. Commented Apr 20, 2013 at 8:52
  • You are escaping straight into another string, what is the point doing this? Are you using constant place holders or variables as placeholders? Commented Apr 20, 2013 at 9:11

2 Answers 2

1

Check the result of the string concatenation. It looks a little iffy:

"java Autoingestion USERNAME 'PASSWORD' VENDORID REPORT_TYPE DATE_TYPE REPORT_SUB_TYPE 2012-05-28"

You are not using any variables, or anything else, so there is no reason to concatenate stuff.

Even if the capitalized parts are placeholders you do not have to concatenate. Just use variable interpolation:

$username = 'USERNAME';
$password = 'PASSWORD';
$exec = "java Autoingestion '{$username}', '{$password}', ...";
exec($exec);
Sign up to request clarification or add additional context in comments.

Comments

0

I suggest you to check for the script output (both on stdout and stderr).

Check also the environment variables you need to run the script.

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.