How can I execute a PHP script using command line?

Answers were Sorted based on User's Feedback



How can I execute a PHP script using command line?..

Answer / nikunj

By using CLI ( command line interface)

On command prompt type : php filename

Is This Answer Correct ?    33 Yes 5 No

How can I execute a PHP script using command line?..

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

How can I execute a PHP script using command line?..

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

How can I execute a PHP script using command line?..

Answer / umapathi

sapi

Is This Answer Correct ?    9 Yes 10 No

Post New Answer

More PHP Interview Questions

How can we display the output directly to the browser?

0 Answers  


What is the function to count elements in an array in PHP?

0 Answers  


what is variable scope, which variables are accessible from where and what are "undefined variable" errors?

0 Answers  


How can we set and destroy the cookie in php?

0 Answers  


Tell me how to retrieve a cookie value?

0 Answers  


What advance thing in php7?

0 Answers  


Tell me what's the difference between include and require?

0 Answers  


Which is the Best plateform for PHP?

7 Answers   DLF, Net Solution,


What is a controller php?

0 Answers  


what is different between PHP and Asp.net?

1 Answers  


how to include external php file in to html page?

8 Answers   Eccentric Infotech,


Describe PHP error and logging information?

0 Answers  


Categories