0

I'm making PHP script to move shell script. when hoge < 50.

Code is this. Does it OK?

When I use that script , I click this link.

http://localhost/index.php?hoge=30

<?php
if(isset($_GET['hoge'])) {
    $hoge = $_GET['hoge'];
    print("$hoge<br>\n");
}
if ($hoge > 50 ){
    echo 'F1';
}        
elseif ($hoge == 50) {
    echo 'F2';
} else {
    echo 'F3';
    exec(' /Users/hoge/Desktop/test.sh');
}
?>
1
  • 1
    check script path correct and remove staring white space from '/Users/hoge/Desktop/test.sh' Commented Jan 20, 2015 at 9:10

1 Answer 1

2

You can add a test like

   if (file_exists('/Users/hoge/Desktop/test.sh')) {
    exec('/Users/hoge/Desktop/test.sh');
    } else {
    echo 'NO FILE'
    }

Check also that the file /Users/hoge/Desktop/test.sh is executable

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.