Jump to content


Photo

help with ssh & php tutorial


  • Please log in to reply
3 replies to this topic

#1 eleanor

eleanor
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 23 August 2006 - 02:54 AM

I was trying to get this tutorial to work: http://www.phpfreaks...rials/127/3.php but I keep getting this error:

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /var/www/localhost/htdocs/ssh/phpfreakSSH.inc on line 41

What to do?



#2 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 23 August 2006 - 03:13 AM

What to do?

Post your code a few lines before and a few lines after line 41.

#3 eleanor

eleanor
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 23 August 2006 - 10:54 AM

39        // Build the local command executed on this server.
    40        $cmd = $this->ssh_cmd . ' -n -F '.$config_file.' -i '.$sshkey.' ';
    41        $cmd .= $this->user.'@'.$this->host.' ''.$command.'' > /dev/null &';
    42
    43        exec($cmd);

#4 SammyP

SammyP
  • Members
  • PipPipPip
  • Advanced Member
  • 58 posts
  • LocationLondon

Posted 23 August 2006 - 11:37 AM

Is $command meant to be outside the literal strings on line 41. I think it is.

If so there should be no double-quotes in that line. Change them to single ones.

Hard to tell which are single and double ones here. The ones you have pasted aren't double-quotes, but are two single ones.

If all esle fails, expand all the items to append to the string one line at a time and see where the error is. Seems silly and is a little time-consuming, but this sort of debugging will always help you isolate a problem which has you stumped.

Sam
If this has solved your problem, a quick 'Thanks' is appreciated, but marking the thread as 'Solved' is better - it saves a lot of time.

Sam.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users