How can I execute a PHP script using command line?

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is api used for?

489


What is the best php framework 2018?

540


Why do we use csrf token?

527


What is difference between count or sizeof function in php?

544


How do you connet mysql database with php?

538






What is use of htmlspecialchars php?

522


What does echo mean in php?

564


How many types of session are there?

550


What is die in php?

567


How to retrieve values out of an array?

531


What is meant by an associative array?

529


Does php have block scope?

530


How do I use isdigit function?

568


Is it difficult to learn php?

545


What is html used for?

561