Changes

Jump to: navigation, search

PHP Operators

No change in size, 14:48, 31 May 2007
PHP Execution Operator - Executing Server Side Commands
== PHP Execution Operator - Executing Server Side Commands ==
All of the operators we have looked at so far are similar to those available in other programming and scripting languages. With the execution operator, however, we begin to experience the power of PHP as server side scritping scripting environment. The execution operator allows you us to execute a command on the operating system that hosts your web servber server and PHP module and then capture the output.
You can do anything in an execution operator that you could do as if you were sitting at a terminal window on the computer (within the confines of the user account under which PHP is running). Given this fact , it should not escape your attention that there are potential security risks to this, so this PHP feature should be used with care.
The excecution operator consists of enclosing the command to be executed in back quotes (`). The following example runs the UNIX/Linux ''uname'' and ''id'' commands to display information about the operating syustem and user account on which the web server and PHP module are running (note that these command will not work if you are running a Windows based server):
echo `dir`;
?>
</pre>

Navigation menu