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 destroy the session, how can we unset the variable of a session?

3 Answers  


Is numeric in php?

0 Answers  


just explain MYSql ISAM and InnoDB functions. and what is the diffrent between both. and which is the better in both.

2 Answers  


How to get the total number of values in an array?

0 Answers  


write the function to fetch a image from mysql databases (datatype blob).

1 Answers  


What is the use of dual table in mysql?

0 Answers  


Explain the importance of the function htmlentities.

0 Answers  


Is salary a ratio or interval?

0 Answers  


What are the features of object-oriented programming in php?

0 Answers  


how to insert logout time when browser close

1 Answers   Global Softtech,


can we swap two different string using php for example:-- before swapping:-- 1 string :-hello friend, 2 string :-my dear, after swapping that strings will be: 1.hello dear, 2.my friend.

0 Answers  


Which is variable cost?

0 Answers  


Categories