passing parameters to php script

I want to send some parameters to php script:
The script is called in this way:
exec("path_to_php.exe sript_to_call.php." > /dev/null 2>&1 &");      
and I want to send one or more parameters to this script.
How can I do this? I'am not sure if this can be made with exec.
any help is welcome.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Loganathan NatarajanLAMP DeveloperCommented:
try like this,
exec("php -f /var/www/html/ contact_id=$contact_id company_id=$company_id req_amount=$amount_1 > /dev/null &");
BorsecAuthor Commented:
logudotcom: how can I use contact_id in the script?
Loganathan NatarajanLAMP DeveloperCommented:
sorry, you need to have one more output variable and to be retrieved in the script.

exec("php -f /var/www/html/ contact_id=$contact_id company_id=$company_id req_amount=$amount_1 > /dev/null &", $output);

Open in new window

OWASP: Forgery and Phishing

Learn the techniques to avoid forgery and phishing attacks and the types of attacks an application or network may face.

BorsecAuthor Commented:
sorry, but this is not working for me
if I make something like this:
exec($phpPath." ".Script.php." > /dev/null  &");      
the script is executed corectly
BUT when I make this
exec($phpPath." ".Script.php." definitionName=$_definitionName > /dev/null  &",$output);
I can not get the value of $output.
I tried to use in Script.php:
-print_r($argv) - not working
-for( $i=1; $i < $argc; ++$i){
         echo $argv[$i];   -  not working

I tried to remove  > /dev/null  & - not working
How can I get the passed value??
Ray PaseurCommented:
Try using a URL something like this:


Then use this command to see if you are getting the right information:


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
BorsecAuthor Commented:
Helped me to find the problem.
Ray PaseurCommented:
Thanks for the points! ~Ray
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.