2010-05-10 100 views
2

我有這樣的shell腳本PHP系統()的幫助

#!/bin/sh 

############################################################# 
# Example startup script for the SecureTrading Xpay4 client # 
# Install Xpay4 into /usr/local/xpay4      # 
# To run this script automatically at startup, place the # 
# following line at the end of the bootup script.   # 
# eg. for RedHat linux: /etc/rc.d/rc.local     # 
#               # 
# /usr/local/xpay4/xpay4.sh         # 
############################################################# 

# Configuration options 

# Path to java executable 
JAVAPATH=/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home 

########## Do not alter anything below this line ########## 
echo "Starting Xpay4. Please ensure the Xpay4 client is not already running" 
$JAVAPATH/java -jar /usr/local/xpay4/Xpay4.jar /usr/local/xpay4/xpay4.ini & 

,我試圖利用來運行它,

system("/x/sh/shell.sh"); 

我這樣做,當用戶瀏覽到某個頁面我網站,但我只是一個白色的空白屏幕是有辦法錯誤檢查系統(),我目前正在使用

error_reporting(E_ALL | E_STRCIT) 

和那是應用si te wide

+0

您確定您擁有該shell腳本的執行權限嗎? – 2010-05-10 16:36:22

+2

'E_STRCIT'應該是'E_STRICT' – 2010-05-10 16:39:55

+0

改變'error_reporting()'水平不會告訴你shell腳本是否真正起作用。 'error_reporting()'僅用於內部PHP錯誤/警告。把它想象成去雜貨店,但忘記你的雜貨清單。你到了商店(函數調用正確執行),但你不能買任何雜貨(列表錯誤)。缺乏列表並不是PHP的問題,因此它不會報告任何錯誤:畢竟,你確實到過雜貨店。 – 2010-05-10 21:43:59

回答

0

您也可以嘗試顯示從腳本輸出的情況下,有一些問題與PHP調用它:

system("/x/sh/shell.sh", $output); echo $output;

希望這會給你一個更有趣的輸出。

+0

以文件路徑不正確結束 – 2010-05-11 08:58:11

0

是否啓用安全模式? 作爲manual說:

當啓用安全模式時,您只能在safe_mode_exec_dir之內的執行文件。出於實際的原因,目前不允許在可執行文件的路徑中包含..組件。

您可以檢查的safe_mode與此腳本:

<?php 
    $safe = ini_get("safe_mode"); 
    var_dump($safe); 
?> 
0

可能

chmod +x /x/sh/shell.sh 

,並嘗試

var_dump(system("/x/sh/shell.sh")); 

系統(),我發現,當我得到一個空白頁這是典型的語法錯誤返回的錯誤

0

假。使用-l(小寫L)選項從命令行運行您的php腳本,如php -l myscript.php。這將檢查代碼是否有任何語法錯誤。然後,如有必要,您可以繼續進行故障排除。