How can I execute a PHP script using command line?

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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain how is it possible to set an infinite execution time for php script?

502


Should I use mysqli or pdo?

509


Explain about the $_GET variable of PHP?

575


Explain me what is the meaning of a persistent cookie?

481


What is the use of htmlspecialchars in php?

522






Can I use php in visual studio?

527


How can you get the size of an image in PHP?

544


What are helpers in php?

466


How could I install codeignitor ?

1733


Is uploaded file php?

535


What are the difference between array_keys() and array_key_exists() in php?

537


What is the $_ server php_self variable?

483


What are the different tables(engine) present in mysql, which one is default?

504


Tell me can the value of a constant change during the script's execution?

569


What are the different data types in javascript?

516