Announcement

Collapse
No announcement yet.

Using SSH with PHP?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using SSH with PHP?

    Not sure if this is such thing but can you manipulate SSH commands using php? I want this so my members can stop/start servers without the need of a client or login root access.

  • #2
    I know it's definitely possible as a friend of mine created a shoutcast script which manipulates the commands of SSH inside PHP. I'm not sure where to find some good examples though.
    Webhosting.UK.com || cPanel VPS Hosting || Reseller Hosting

    Sales: 0808-262-0855
    Support: 0800-612-8725
    International: +44 191 303 8191

    Comment


    • #3
      Originally posted by karimali831 View Post
      Not sure if this is such thing but can you manipulate SSH commands using php? I want this so my members can stop/start servers without the need of a client or login root access.
      It would all depend on exactly what it is you're after achieving. PHP can use either the system() call, or the exec() call but would require to be enabled in the php.ini, though given the security risks, these functions are usually disabled.

      [PHP]
      system('/home/user/shoutcast/sc_serv sc_serv.ini > /dev/null 2>&1') // Start Shoutcast server - output to /dev/null
      [/PHP]

      [PHP]
      system('/home/user/shoutcast/sc_serv sc_serv.ini') // Start Shoucast server - output all to web browser
      [/PHP]


      [PHP]
      exec('/home/user/shoutcast/sc_serv sc_serv.ini', $status) // Start Shoutcast server - output to variable $status ($status will become an array containing every line of output from the command)
      [/PHP]

      I've only used shoutcast as an example as Dan mentioned it in the post above, but these are all possible ways of achieving it.
      Last edited by Hexosphere; 25-08-09, 04:05 PM.
      Hexo
      -------
      The man that knows how, is always working for the man that knows why

      Comment


      • #4
        I use PHP Shell now. It's very much like using the SSH client but on a web page

        You set custom login details without using the website login info.

        Comment

        Working...
        X