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 8728515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:39:36+00:00 2026-06-13T08:39:36+00:00

I am trying to connect to make SSH connections with PHP my hosting company

  • 0

I am trying to connect to make SSH connections with PHP my hosting company says we dont allow SSH connections on shared server.. so is there any workaround, some other functions that i can use to connect.

 <?php


    if (!function_exists("ssh2_connect")) die("function ssh2_connect doesn't exist");
    // log in at server1.example.com on port 22
    if(!($con = ssh2_connect("server5500.asd.com", 22))){
        echo "fail: unable to establish connection\n";
    } else {
        // try to authenticate with username root, password secretpassword
        if(!ssh2_auth_password($con, "asd", "gh45@asd")) {
            echo "fail: unable to authenticate\n";
        } else {
            // allright, we're in!
            echo "okay: logged in...\n";

            // execute a command
            if (!($stream = ssh2_exec($con, "ls -al" ))) {
                echo "fail: unable to execute command\n";
            } else {
                // collect returning data from command
                stream_set_blocking($stream, true);
                $data = "";
                while ($buf = fread($stream,4096)) {
                    $data .= $buf;
                }
                fclose($stream);
            }
        }
    }
    ?>
  • 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-13T08:39:38+00:00Added an answer on June 13, 2026 at 8:39 am

    Try phpseclib, a pure PHP SSH implementation. eg.

    <?php
    include('Net/SSH2.php');
    
    $ssh = new Net_SSH2("server5500.asd.com");
    if (!$ssh->login("asd", "gh45@asd")) {
        exit('Login Failed');
    }
    
    echo $ssh->exec('ls -la');
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to make a socket.io based server but whenever I connect by
Is there a way to make a socket stop trying to connect immediately? It
I am trying to make connect clojure to mysql, but somehow fail. My project.clj
I am trying to connect with google via oauth V2 I make http request
When I am trying to connect to my SVN repository on some remote server
I'm trying to connect to a server using https and when I do it
I'm trying to connect to an access database from a php script using ODBC.
Is it possible to connect to an SSH server through a Telnet connection? I
When trying to connect to a server, my app does not have a very
When I'm trying to connect to my websocket, it says that flash socket policy

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.