我有这个shell脚本
#!/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");
当用户导航到我网站上的某个页面时,我正在这样做,但是我只得到一个白色的空白屏幕是否有办法用system()进行错误检查,我目前正在使用
error_reporting(E_ALL | E_STRCIT)
这适用于网站范围
答案 0 :(得分:0)
是否启用了安全模式? 正如manual所说:
启用安全模式后,您只能执行safe_mode_exec_dir中的文件。出于实际原因,目前不允许在可执行文件的路径中包含..组件。
您可以使用以下脚本检查safe_mode:
<?php
$safe = ini_get("safe_mode");
var_dump($safe);
?>
答案 1 :(得分:0)
您也可以尝试显示脚本中的输出,以防从php调用它时出现问题:
system("/x/sh/shell.sh", $output);
echo $output;
希望这会给你一个更有趣的输出。
答案 2 :(得分:0)
可能是
chmod +x /x/sh/shell.sh
并尝试
var_dump(system("/x/sh/shell.sh"));
system()在错误
时返回false答案 3 :(得分:0)
我发现当我得到一个空白页面时,通常会出现语法错误。使用-l(小写L)选项从命令行运行php脚本,如php -l myscript.php
。这将检查代码是否存在任何语法错误。然后,如有必要,您可以从那里继续进行故障排除。