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 are php expressions?

594


How can we access the data sent through the url with the post method?

503


What is session and why do we use it?

550


What does the unset() function means?

589


Is php harder than javascript?

428






Which php mvc framework is best?

556


What is the use of is_array() and in_array()?

539


How we get browser details of clients machine?

516


How to check a variable is array or not in php?

555


How to pass variables by references?

553


Can I run php without xampp?

498


Is php front end?

502


How many types of session are there?

537


What is a variable cost example?

545


Explain the difference between array_merge() and array_combine()?

529