PHP系统()的帮助

问题描述:

我有这样的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

您也可以尝试显示从脚本输出的情况下,有一些问题与PHP调用它:

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

希望这会给你一个更有趣的输出。

+0

以文件路径不正确结束 – 2010-05-11 08:58:11

是否启用安全模式? 作为manual说:

当启用安全模式时,您只能在safe_mode_exec_dir之内的执行文件。出于实际的原因,目前不允许在可执行文件的路径中包含..组件。

您可以检查的safe_mode与此脚本:

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

可能

chmod +x /x/sh/shell.sh 

,并尝试

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

系统(),我发现,当我得到一个空白页这是典型的语法错误返回的错误

假。使用-l(小写L)选项从命令行运行您的php脚本,如php -l myscript.php。这将检查代码是否有任何语法错误。然后,如有必要,您可以继续进行故障排除。