How can I execute a PHP script using command line?
Answers were Sorted based on User's Feedback
Answer / nikunj
By using CLI ( command line interface)
On command prompt type : php filename
| Is This Answer Correct ? | 33 Yes | 5 No |
Answer / tamilselvan
PHP script using command line can be executed using SAPI
(Server Application programming Interface). Using SAPI
Command Line Interface the PHP code can be passed to execute
directly
Example:
Php –r ‘print_r(get_defined_constanrs());’
From a shell, php –v will display whether the SAPI is CLI or CGI
| Is This Answer Correct ? | 12 Yes | 4 No |
Answer / indra
By using CLI ( command line interface)
On command prompt type : php filename
Example:
Php –r ‘print_r(get_defined_constanrs());’
From a shell, php –v will display whether the SAPI is CLI or CGI
| Is This Answer Correct ? | 4 Yes | 2 No |
What is mod_php?
how to add file in php?
How do I find out the number of parameters passed into function?
Tell me in php, objects are they passed by value or by reference?
Why does php start with variables?
Write a query to to delete duplicate rows?
what are Implode and Explode functions?
Shopping cart online validation i.e. how can we configure Paypal, etc.?
How many data types are there in php?
What is in a cookie?
What is pdo classes?
how to select single row from table and insert into same table as a new record by using a single sql query.