开发者

PHP system() help

开发者 https://www.devze.com 2022-12-30 00:12 出处:网络
I have this shell script #!/bin/sh ############################################################# # Example startup script for the SecureTrading Xpay4 client #

I have this shell script

    #!/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 &

And I am trying to run it using,

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

I am doing this when a user navigates to a certain page on my site, however I am getting just a white blank screen is there a way to error check with system(开发者_如何学C), I am currently using

error_reporting(E_ALL | E_STRCIT)

and that is applied site wide


You might also try displaying the output from your script in case there is some issue with calling it from php:

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

Hopefully that will give you a more interesting output.


may be

chmod +x /x/sh/shell.sh

and try

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

system() returns false on error


Is there a safe-mode enabled? As a manual says:

When safe mode is enabled, you can only execute files within the safe_mode_exec_dir. For practical reasons, it is currently not allowed to have .. components in the path to the executable.

You can check safe_mode with this script:

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


I've found that when I get a blank page it's typically a syntax error. Run your php script from the command line with -l (lower-case L) option, like php -l myscript.php. That will check the code for any syntax errors. Then you can continue troubleshooting from there if necessary.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号