Welcome Guest, Not a member yet? Register   Sign In
Configure SSH Library
#1

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
Reply
#2

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.
Reply
#3

(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
Reply
#4

To acess ssh you need: ssh host-or-ip@user-with-root-power. Then it ask a password.
ex.: ssh [email protected].
PHP is Life!!! See My Portfolio
Reply
#5

(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.
Reply
#6

(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
Reply




Theme © iAndrew 2016 - Forum software by © MyBB