exec command on remote server and store output

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dmallia
Forum Commoner
Posts: 25
Joined: Sat Nov 19, 2011 3:18 pm

exec command on remote server and store output

Post by dmallia »

So basically I need a script to execute the command(either by ssh or php) 'ls -l' but I need to be logged in as root, and than I want to store the output data in a variable $output. Any ideas how to do it?
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: exec command on remote server and store output

Post by Celauran »

dmallia wrote:So basically I need a script to execute the command(either by ssh or php) 'ls -l' but I need to be logged in as root, and than I want to store the output data in a variable $output. Any ideas how to do it?
This sounds like a bad idea. What is it you're trying to accomplish?
dmallia
Forum Commoner
Posts: 25
Joined: Sat Nov 19, 2011 3:18 pm

Re: exec command on remote server and store output

Post by dmallia »

well i will be using it mainly for screen not for ls -l. I need to make sure that there is no screen with the same name as the one that is gong to be executed only if there is no screen already with that name.
Post Reply