php command line interface (cli)

started at 13 Jun 2007 by Nobby
  • Nobby
    13 Jun 2007

    Hi, I have followed the instructions here to build my web server. Great Website by the way, I don't know how to thank you enough. I have a query regarding the php command line interface. I have installed php as per the instructions here, using phpinfo(), through apache I can see that version 5.2.0 is installed. However on the command line version, I type in the terminal php -v and it throws up version 4.4.4. I would like to be able to use version 5 from the command line so as to be able to use php's built in SOAP functionality, but have absolutely no idea where to start, is this still referring to the original mac install for command line php? Does anyone know how to correct this? Any help much appreciated.

    Reagrds. Thanks once again Richard5 for this quality site.

  • Richard
    13 Jun 2007

    Nobby, you are correct. Uoi are using the original PHP if you type which php you'll see where it comes from. The new PHP is located in /usr/local/php5/bin/php. You have 3 options to change how you use it for CLI

    Copy /usr/local/php5/bin/php to /usr/bin/php

    or

    Change the PATH variable in your Terminal to point to /usr/local/php5/bin/ first before /usr/bin

    or

    use the full command with path when you want to execute a command like /usr/local/php5/bin/php options file.php

    Good luck !

Reply

You must log in to post.