0

I've been searching through out the net on how I can possibly make it happen in php. The scenario is my php application is in computer A and the shell script file that I want to execute is in Computer B. and I want my php application in computer A to execute the shell script file in Computer B.

I understand that permission plays a very important role on this but I can access computer B so no problem for setting permission.

By the way, computer A is windows server and Computer B is kubuntu. Does anyone has an idea? Thank you

2 Answers 2

1

You can use ssh functions in PHP to achieve the thing you are looking for,

refer http://php.net/manual/en/ssh2.requirements.php

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

Comments

1

Too bad can't add packages, just solved it by this

public function execScript($connection, $script)
{

    // Execute script        
    exec("ssh $connection $script 2>&1", $output, $error);

    if ($error) {
        throw new Exception ("\nError: ".print_r($output, true));
    }

    return $output;
}

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.