Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7706487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:08:15+00:00 2026-06-01T00:08:15+00:00

There are 2 servers (server A and server B). The server A will send

  • 0

There are 2 servers (server A and server B). The server A will send a command and server B execute it.

I had try the below code running from server A to instruct server B do a job and it work successful:

$connection = ssh2_connect('server.com', 22);
ssh2_auth_password($connection, 'username', 'password');

ssh2_exec($connection, 'mv /var/www/test.php /root');

var_dump($connection);

from the above code, it will move test.php to the root folder. The problem happen if I try running the .sh file using the same code, it seems not running at all. Below is my example code to run .sh file

$connection = ssh2_connect('serverB.com', 22);
ssh2_auth_password($connection, 'username', 'password');

ssh2_exec($connection, './var/www/bbb_clean.sh');

var_dump($connection);

If I run the bbb_clean.sh manually from the server B, it works . Please help me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T00:08:16+00:00Added an answer on June 1, 2026 at 12:08 am

    I would try to use phpseclib, a pure PHP SSH implementation, and enable logging to see what’s going on. eg.

    <?php
    include('Net/SSH2.php');
    define('NET_SSH2_LOGGING', NET_SSH2_LOG_COMPLEX);
    
    $ssh = new Net_SSH2('www.domain.tld');
    if (!$ssh->login('username', 'password')) {
        exit('Login Failed');
    }
    
    echo $ssh->exec('pwd');
    echo $ssh->getLog();
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In SQL Server there is a way to join tables from multiple sql servers
Is there a tool that will let you visualize a SQL Server 2008 cascade
On a server there are several independent Plone buildout installations, running under different UNIX
Getting these errors in some java code http://tutorials.jenkov.com/java-multithreaded-servers/multithreaded-server.html Exception in thread Thread-0 java.lang.RuntimeException: Cannot
I have a client/server program that attempts to send and receive an object. There
I want A computer to responsible for execute the command, and B computer will
I try to talk to a server, by telneting to it, and send the
I'm working on a server-to-server authentication via RMI. There's on application-server (server part) and
Here is a situation, There is SERVER A and SERVER B, SERVER B wants
In sql-server there is function to auto-increment guid fields. CREATEGUID() how can I do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.