Search code examples
phpwindowscommand-line-argumentsphp-resque

How to pass environment variables to a php script in windows


I'm just a starter in command line applications. I want to know how I can be able to pass environment variables to a php script running in the command line on windows 7 machine.

I want to do something similar to this:

QUEUE=notification VVERBOSE=1 php resque.php

Thank you for help..!


Solution

  • I finally got this working.

    On Unix systems you can set the environment variables on the same line invoking the script.

    QUEUE=notification VVERBOSE=1 php resque.php
    

    But for windows Os, you need to first set the environment variable like this

    SET QUEUE=notification
    
    SET VVERBOSE=1
    

    Then you invoke the script

    php resque.php
    

    Thank you to all who contributed...!