Building Chinese Web Sites Using PHP - Version 2.20, by Dr. Herong Yang
Running PHP Scripts
This section describes how to run PHP scripts in a command window in normal mode and in CGI mode.
PHP scripts can be executed with two different command interfaces:
To do a quick test with both interfaces, I wrote the following simple script, hello.php, with a text editor:
Hello <?php echo "world!"; ?>
I used the \local\php\php.exe to execute this script in a command window:
C:\herong> \local\php\php hello.php Hello world!
Then, I used the \local\php\php-cgi.exe to execute this script in a command window:
>\php\php-cgi Hello.php X-Powered-By: PHP/7.3.0 Content-type: text/html; charset=UTF-8 Hello world!
PHP CGI, php-cgi.exe, generated the HTTP response header as required by the Web server.
Congratulations, PHP engine is stalled and working!
To learn more about running PHP scripts, read my other book: "PHP Tutorials - Herong's Tutorial Examples at herongyang.com/PHP
Last update: 2019.
Table of Contents