Jump to content

Archived

This topic is now archived and is closed to further replies.

eleanor

help with ssh & php tutorial

Recommended Posts

I was trying to get this tutorial to work: http://www.phpfreaks.com/tutorials/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?

Share this post


Link to post
Share on other sites
[quote]What to do?[/quote]
Post your code a few lines before and a few lines after line 41.

Share this post


Link to post
Share on other sites
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);

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.