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

What does $_files means?

0 Answers  


What is the content of /etc directory?

0 Answers  


What is api used for?

0 Answers  


I am a 2007 Passed out, Jobless for almost 2.6 years. I am preparing myself as a Php programmer. Will i get a job in Php and can any one guide me please.

5 Answers   HCL,


Do you know how to declare an array in php?

0 Answers  






What is the use of header() function in php?

0 Answers  


Explain the difference between require() and require_once()?

0 Answers  


What does $_cookie means?

0 Answers  


What is the full form of PHP?

28 Answers   Apple, Nandhini, PHP,


What is the use of header in php?

0 Answers  


How do you run a php script from the command line?

1 Answers  


What type of language is php?

0 Answers  


Categories