Jump to content

help with ssh & php tutorial


eleanor

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?

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.