Difference between revisions of "PHP"
Jump to navigation
Jump to search
Line 9: | Line 9: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | |||
+ | ;escapeshellcmd(shellcommand) | ||
+ | :Return the shellcommand with everything that might confuse the shell escaped. | ||
;exec(<cmd>,<outputarray>,<returnvar>) | ;exec(<cmd>,<outputarray>,<returnvar>) | ||
:Executed <cmd> in the shell, append the command output to he array <outputarray> and set <returnvar> to the returnvalue of the command. | :Executed <cmd> in the shell, append the command output to he array <outputarray> and set <returnvar> to the returnvalue of the command. | ||
:Also the last line of the command output is returned | :Also the last line of the command output is returned | ||
− | |||
;shell_exec(<cmd>) | ;shell_exec(<cmd>) | ||
− | : | + | :Execute <cmd> (output from excapedshellcmd) in the shell, return the command output. |
=Functions= | =Functions= |
Revision as of 21:10, 7 October 2019
Script language for dynamic web-pages. The syntax and concepts used are similar to Perl
Loop over an associative array (hash):
foreach ( $_POST as $key => $value ) {
echo $key.' '.$value.' '.$_POST[$key].'<br>';
}
- escapeshellcmd(shellcommand)
- Return the shellcommand with everything that might confuse the shell escaped.
- exec(<cmd>,<outputarray>,<returnvar>)
- Executed <cmd> in the shell, append the command output to he array <outputarray> and set <returnvar> to the returnvalue of the command.
- Also the last line of the command output is returned
- shell_exec(<cmd>)
- Execute <cmd> (output from excapedshellcmd) in the shell, return the command output.
Functions
Function have global scope, you do not need to declare them before calling
<?php
function func1($arg1, $arg2)
{
<codeblock>
return $value;
}
?>
Install
On debian (and its derivates)
- apt-get install php-fpm php-mysql
- Install php7 and mysql support
- Fix php security by editing
/etc/php/7.0/fpm/php.ini
- Uncomment line with cgi.fix_pathinfo and set it to 0