2011-09-29 151 views
0

由於某種原因,當通過apache調用下面的php腳本時,沒有返回結果...在php.ini中是否有系統安全設置允許系統命令?php無法執行系統命令

<div style="background:#000;color:#fff"> 
<?php 

    $cmd = "/bin/date"; 
    $output = system($cmd); 
    printf("System Output: $output\n"); 
    exec($cmd, $results); 
    printf("Exec Output: {$results[0]}\n"); 
    echo"<pre>"; 
    echo system('/bin/ls'); 
    echo"</pre>"; 
    ?> 
    </div> 
+0

我檢查了php.ini,disable_functions =是空白。 – Cmag

+0

什麼不返回? 'system'或'exec'或兩者兼而有之? – hakre

+0

既不.....系統也在plesk上...... :) – Cmag

回答

1

您的主機(或配置)可能會限制system()或exec()命令。檢查您的配置或聯繫您的主機

; This directive allows you to disable certain functions for security reasons. 
; It receives a comma-delimited list of function names. This directive is 
; *NOT* affected by whether Safe Mode is turned On or Off. 
; http://php.net/disable-functions 
disable_functions = 

應該是空白,作品在我的機器

http://sandbox.phpcode.eu/g/e47f7

上。另外,檢查SELinux和Suhoshin被正確配置

+0

謝謝! disable_functions =爲空,檢查selinux – Cmag

+0

夥計,selinux已禁用......這是怎麼回事? – Cmag

+0

也看到sh:/ date:沒有這樣的文件或目錄 sh:/ date:沒有這樣的文件或目錄 sh:/ ls:apache日誌中沒有這樣的文件或目錄 – Cmag

0

的Plesk安全模式.. 。在httpd.include中禁用...嘆息...當系統着陸在你的腿上時愛它