562 Part IV: Using PHP for Sysadmin Tasks (Disney web site)

562 Part IV: Using PHP for Sysadmin Tasks It s good practice to get in the habit of using the q option when running PHP from the command line to suppress the HTML headers. That way you are sure to suppress the headers. In the 4.3.x version of PHP (compiled with the –enable-cli option), you can also run the following: php q -r echo Your PHP Code ; Here, the echo statement will be executed as if it were in a script. This type of execution is not suitable for most real problem-solving work. It is most useful when you want to write a quick and dirty script for one-time use. Reading standard input Reading input from the shell is a common task performed by a command-line script. Listing 16-2 shows a simple script called ask.php, which reads user input from a command-line prompt. Listing 16-2: ask.php #!/usr/bin/php -q

Leave a Reply