shell_exec ÇÔ¼ö¸¦ ÀÌ¿ëÇϸé PHP»ó¿¡¼ ½©¸í·É¾î¿¡ ´ëÇÑ °á°ú°ªÀ» À¥»ó¿¡ Ãâ·ÂÇÒ¼ö ÀÖ´Ù.
¾ÈÀü¸ðµå»ó¿¡¼´Â ½ÇÇàµÇÁö ¾ÊÀ¸´Ï php.ini ÆÄÀÏÀ» È®ÀÎ
safe_mode = Off
mojily_test.php
<?php $data1 = shell_exec("ls -l /home/"); echo "<pre> $data1 </pre>";
$data = shell_exec("df -Th"); echo "<pre> $data </pre>" ?> |
À¥¿¡¼ÀÇ Ãâ·Â°á°ú
±×·¸´Ù¸é À¥¿¡¼ ¸í·É¾î¸¦ Á÷Á¢Àû¾î Àü¼ÛÇÏ´Â °úÁ¤À» º¸¸é...
test.html
<html> <form action="mojily_test.php" method="get"> INPUT CMD : <input type="text" name="value1"> <input type="submit" value="Àü¼Û"> </form> </html>
mojily_test.php
<?php $data = shell_exec("$value1"); echo "<pre> $data </pre>"; |
¾Æ·¡¿Í °°Àº â¿¡ ¸í·É¾î¸¦ Àû¾îÁÖ¸é µ¿ÀÏÇÑ °á°ú°¡ Ãâ·ÂµÈ´Ù.
shell_exec
(PHP 4 , PHP 5)
shell_exec -- Execute command via shell and return the complete output as a string
Description
string
shell_exec ( string cmd)
Âü°í: ÀÌ ÇÔ¼ö´Â
¾ÈÀü ¸ðµå¿¡¼ »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.