Sr. PHP Programmer Question: Download Senior PHP Programmer PDF

Explain how to execute a PHP script using command line?

Tweet Share WhatsApp

Answer:

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

Download Senior PHP Programmer PDF Read All 202 Senior PHP Programmer Questions
Previous QuestionNext Question
How does one prevent the following Warning 'Warning: Cannot modify header information - headers already sent' and why does it occur in the first place?Is PHP a case sensitive language?