Now: Tutorial for Web and Software Design > PHP > QA > PHP Content
> PHPFAQ - How do I run a php script from the command line? [Bookmark it]
PHPFAQ - How do I run a php script from the command line?


Question :

How do I run a php script from the command line?

Answer :No matter what OS you have installed you need to compile / install php as a CGI because when you have php as a CGI you have a binary you can execute from anywhere like a command prompt.

If you use a unix like OS you should do:
/path/to/php -f /path/to/script.php

For windows OS's do:
c:\path\to\php.exe -f c:\path\to\script.php


The parameter -f is put on because we want to parse a file, the -f also implies -q which means you dont get any HTTP header output which in most cases is usefull when making command line scripts.

[Bookmark][Print] [Close][To Top]
  • Prev Article-PHP:

  • Next Article-PHP:
  • Related Materias
    PHPFAQ - How google is you
    PHPFAQ - Are there any web
    PHPFAQ - How can I accept 
    PHPFAQ - How can I finance
    PHPFAQ - Where can I get P
    PHPFAQ - Where can I host 
    PHPFAQ - Where can I find 
    PHPFAQ - I am trying to cr
    PHPFAQ - Is there a librar
    PHPFAQ - How can I manage 
    Topics
    Photoshop Tutorial
     

    Special Effect

      3D Effect
      Photoshop Articles
    Programming Tutorial
     

    C/C++ Tutorial

      Visual Basic
      C# Tutorial
    Database Tutorial
     

    MySQL Tutorial

      MS SQL Tutorial
      Oracle Tutorial
    Graphic Design Tutorial
     

    Coreldraw Tutorial

      Illustrator Tutorial
      3D Graphics Articles
    Webmaster Articles
     

    Domain Service

      Web Hosting
      Site Promotion
    Java Tutorial&Articles
     

    Java Servlets

      JavaEE Tutorial
     

    JavaBeans Tutorial

    XML Tutorial&Articles
     

    XML Style Tutorial

      AJAX Tutorial
      XML Mobile
    Flash Tutorial&Articles
     

    Flash Video

      Action Script
      Flash Articles
    OS Tutorial&Articles
     

    Linux Tutorial

      Symbian Tutorial
      MacOS Tutorial