Spacedust
Spacedust

Reputation: 1031

Using sed inside php script is causing unexpected T_STRING error

I'm adding a line to my php script:

exec('sed -i 1i'MAILTO=""' /var/spool/cron/' '.$clientName.');

But it shows me an error:

PHP Parse error:  syntax error, unexpected T_STRING in /home/admin/myproject.pl/newclient/main.php on line 368

Parse error: syntax error, unexpected T_STRING in /home/admin/myproject.pl/newclient/main.php on line 368

Upvotes: 0

Views: 224

Answers (1)

Madara's Ghost
Madara's Ghost

Reputation: 175048

I think the error says it quite well. You have a syntax error.

Perhaps this is what you wanted?

exec('sed -i \'1i MAILTO=""\'  /var/spool/cron/'.$clientName);

Upvotes: 2

Related Questions