Dismiss Notice
Welcome to Our Community
Wanting to join the rest of our members? Feel free to sign up today.

Tip : Using PHP scripts from command line

Discussion in 'Programming' started by dman_2007, Apr 19, 2008.

  1. dman_2007

    dman_2007 Guest

    PHP can be used to script common system administration tasks. PHP scripts run from command line differ from web based PHP scripts in following way :
    1. Unlike web based scripts, there is no maximum execution time limit. A script can run for as long as it needs to be run for finishing its tasks.
    2. Any output produced by echo, print etc is immediately flushed.
    3. PHP errors are displayed in plain text instead of using html.
    4. argv and argc variables are used for retrieving command line parameters passed by user. argv is an array which contains actual command line parameters alongwith script name and argc is an integer variable which contains the total number of parameters passed to the script.
    5. Finally, use STDIN, STDOUT and STDERR constants which are streams connected to standard out, standard input and standard error.

Featured Resources (View All)

Share This Page