1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How do I run PHP from CMD?

Discussion in 'General Programming Chat' started by secretbonus, Jan 8, 2010.

  1. secretbonus

    secretbonus Registered Member

    Joined:
    Mar 24, 2009
    Messages:
    77
    Likes Received:
    24
    Okay, so I'm trying to use the adwords API so I can extract a huge keyword list like the one on xedant.com. Now I followed the video tutorial except the problem is when I try to run php on command prompt it says "php is not recognized as an internal or external command, operable program or batch file"
    what do I need to do so that I can run php command C:\example>php filename.php
    ?
     
  2. phr34k

    phr34k Newbie

    Joined:
    Feb 17, 2009
    Messages:
    9
    Likes Received:
    1
    Occupation:
    CEO of a web development agency
    Location:
    Memphis, TN USA
    You need the PHP-CLI package. In linux, you can just compile php with the --enable-cli flag, but I am not too sure about windows. Check out http://php.net/features.commandline for more info.
     
  3. kerxupt

    kerxupt Newbie

    Joined:
    Nov 4, 2009
    Messages:
    17
    Likes Received:
    0
    C:\php\bin\php <scriptname.php>

    On Windows that's typically how you run a PHP CLI script.