Web Hosting Talk







View Full Version : Help !! Connectin TO SHH


Mr-Max
04-27-2007, 10:34 AM
Hello !!


I need function or class to make connection to shell whith PHP pages >>


I tried whith php.net articles , But ......:o



thanks

M3TechSolutions
04-27-2007, 01:35 PM
Well you have a few options all depending on what your server will support.

If your server has php's EXEC() enabled then you could just send what commands you want to use in the shell to EXEC().

Or if this is disabled on your server, using a shell script will work as well. Create a script with a .sh extension, put whatever you need to send to the shell in this script and then have php call said .sh script.

Hope this helps,
Cody

Mr-Max
04-28-2007, 01:59 PM
Thank you Cody .....

i`ll try , then i`ll tell u

Thanks Alot .


Mr-Max

bqinternet
05-02-2007, 05:55 AM
There is an SSH module for PHP, but it is not included by default, and I found it to be a bit too underdeveloped. The method I opted to use will work with a standard PHP installation, and makes use of the proc_open() function to execute the system's SSH client.

http://us2.php.net/manual/en/function.proc-open.php

After calling the appropriate SSH command, you can then use fwrite() and fread() to interact with it. In this way, you can work with the interactive shell on the other side of the SSH connection.

M3TechSolutions
05-02-2007, 12:10 PM
No problem glad I could help.