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 is the meaning of xdebug?

0 Answers  


How to track user logged out or not? When user is idle?

0 Answers  


What is the most common http method?

0 Answers  


When do you use define() and when do you use const. What are the main differences between those two?

0 Answers  


Differences between get, post and request methods ?

0 Answers  






Why should I learn php?

0 Answers  


Any good PHP developer looking for change

1 Answers  


How do you remove whitespace from the beginning and end of a $string variable?

0 Answers  


What is the meaning of curl , which is used while connecting with pay pal? and how it works?

2 Answers  


How to create a session? How to set a value in session? How to remove data from a session?

0 Answers  


What is the difference between mysql_fetch_array() and mysql_fetch_assoc()?

0 Answers  


How does firefox manage cookies?

0 Answers  


Categories