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 a php namespace?
Tell me what does $_env means?
How can we destroy the cookie?
Tell us what does $_cookie means?
What is a query give example?
Explain what does the expression exception::__tostring means?
Explain why would we use === instead of ==?
How can I find my php version?
What is difference between web service and api?
What are some of the advanced features of php?
Differentiate between require and include?
What is static method php?