CodeIgniter Forums
Configure SSH Library - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11)
+--- Thread: Configure SSH Library (/showthread.php?tid=61443)



Configure SSH Library - tushar.niras - 04-15-2015

Hi There,

I want to execute 'CLI' commands to my Linux Server over the SSH connection.

Someone please help me to, step by step guide to Configure SSH Library and execute some commands.

I am using Codelgniter2.x.

Best Regards,

TUSHAR NIRAS


RE: Configure SSH Library - CroNiX - 04-16-2015

Not sure what you mean, CI can use the CLI by executing "php -q /path/to/index.php controller method". Like "php -q /home/user/public_html/index.php blog view" to execute the blog controller/view method.
http://www.codeigniter.com/userguide2/general/cli.html

Just remember that $_SERVER variables are set by the webserver, so if you are using CLI $_SERVER won't be present since it doesn't use the webserver and just executes php from the CLI. So if your app uses the $_SERVER superglobal, your app probably won't work via the CLI. Also things like sessions won't work using the CLI since there's no way to store and read cookies since there's no web browser involved.


RE: Configure SSH Library - tushar.niras - 05-26-2015

(04-16-2015, 08:25 PM)CroNiX Wrote: Not sure what you mean, CI can use the CLI by executing "php -q /path/to/index.php controller method". Like "php -q /home/user/public_html/index.php blog view" to execute the blog controller/view method.
http://www.codeigniter.com/userguide2/general/cli.html

Just remember that $_SERVER variables are set by the webserver, so if you are using CLI $_SERVER won't be present since it doesn't use the webserver and just executes php from the CLI.  So if your app uses the $_SERVER superglobal, your app probably won't work via the CLI. Also things like sessions won't work using the CLI since there's no way to store and read cookies since there's no web browser involved.

Dear CroNix,

I want to access linux server via SSH. and execute the commands from  Web Application


RE: Configure SSH Library - calcio - 05-28-2015

To acess ssh you need: ssh host-or-ip@user-with-root-power. Then it ask a password.
ex.: ssh [email protected].


RE: Configure SSH Library - tushar.niras - 07-08-2015

(04-16-2015, 08:25 PM)CroNiX Wrote: Not sure what you mean, CI can use the CLI by executing "php -q /path/to/index.php controller method". Like "php -q /home/user/public_html/index.php blog view" to execute the blog controller/view method.
http://www.codeigniter.com/userguide2/general/cli.html

Just remember that $_SERVER variables are set by the webserver, so if you are using CLI $_SERVER won't be present since it doesn't use the webserver and just executes php from the CLI.  So if your app uses the $_SERVER superglobal, your app probably won't work via the CLI. Also things like sessions won't work using the CLI since there's no way to store and read cookies since there's no web browser involved.

Hi Cronix,

Can I have SSH Library for CodeIgniter. I want to execute CLI commands on Linux machine using CodeIgniter.


RE: Configure SSH Library - tapan.thapa - 07-09-2015

(07-08-2015, 10:40 PM)tushar.niras Wrote:
(04-16-2015, 08:25 PM)CroNiX Wrote: Not sure what you mean, CI can use the CLI by executing "php -q /path/to/index.php controller method". Like "php -q /home/user/public_html/index.php blog view" to execute the blog controller/view method.
http://www.codeigniter.com/userguide2/general/cli.html

Just remember that $_SERVER variables are set by the webserver, so if you are using CLI $_SERVER won't be present since it doesn't use the webserver and just executes php from the CLI.  So if your app uses the $_SERVER superglobal, your app probably won't work via the CLI. Also things like sessions won't work using the CLI since there's no way to store and read cookies since there's no web browser involved.

Hi Cronix,

Can I have SSH Library for CodeIgniter. I want to execute CLI commands on Linux machine using CodeIgniter.

Have you tried this?

http://phpseclib.sourceforge.net/ssh/examples.html