|
Most admins tend to use the shell, Perl,or Python if they need a system administration script. But there is no need for web programmers to learn another language just to script a routine task. PHP gives admins the power to program command-line tools and even complete web interfaces.
PHP scripts written for the console are basically the same as scripts written for the web: programmers can use the whole range of PHP features. To allow simple, program name based execution of scripts on the command-line, you need to specify the PHP interpreter in the first line of the script following #!. If you do not know the path to the interpreter, you can type which php to find out. Also, the script file needs to be executable. Let’s take a look at the ubiquitous “Hello, World” example in PHP: #!/usr/bin/php -q <?php echo "Hello, World\n"; ?>
PHP tools are typically all you need for any kind of text manipulation, such as modifying configuration files, log files, user management entries, and the like. If you need to access operating system functions for tasks such as process management, you will need to add a few Linux commands.
|
| Related Articles | |
|---|---|
| CUSTOM VIEW | Visualizing your Nagios network with NagVis |
| SCHEMAS AND TIN FOIL | Community Notes |
| INSECURITY NEWS | |
| INSECURITY NEWS / USERFRIENDLY | |
| INSECURITY NEWS / USERFRIENDLY | |
| INSECURITY NEWS / USERFRIENDLY | |
| Live Streaming from ApacheCon Europe 2009 |
|---|
|
All about Apache in 19 talks Watch 3 days full of Apache talks live from Amsterdam on March 25-27 in the convenience of your home or office. Topics are: Apache Hadoop, Tomcat for Developers and Administrators, HTTP Server Administration and much more. |
Comments