tedleonard — 2013-09-10T07:24:09-04:00 — #1
I am trying to set up a canned script, and in trying to get it to work I've come across a syntax error I don't really understand. I ran the following command via ssh on my webserver:
/usr/bin/php -c /home/path/to/mailPipe.php
and here is the response I get:
PHP: syntax error, unexpected '(' in /home/path/to/mailPipe.php on line 4
here is the php code
$save_directory = __DIR__;
$db_host = 'localhost';$db_un = '***';$db_pass = '***';$db_name = '***';$pdo = new PDO("mysql:host=$db_host;dbname=$db_name;charset=utf8",$db_un,$db_pass);
$allowed_senders = Array('firstname.lastname@example.org', 'email@example.com', 'firstname.lastname@example.org', 'email@example.com', 'firstname.lastname@example.org', 'email@example.com', 'firstname.lastname@example.org', 'email@example.com', 'firstname.lastname@example.org');
$mr = new mailReader($save_directory,$allowed_senders,$pdo);
$mr->save_msg_to_db = TRUE;
$mr->send_email = FALSE;
not sure what could be wrong with that, can someone help? Thank you!!
droopsnoot — 2013-09-10T07:59:52-04:00 — #2
Is it pointing to a syntax error in the mailreader.php file that you include? Leaving out whitespace that conceivably might be line 4?
cpradio — 2013-09-10T08:09:48-04:00 — #3
I don't think you want to use -c .... that refers to pointing to a config file (think php.ini), not your file.
If you want to look for syntax errors, use -l
/usr/bin/php -l /home/path/to/mailPipe.php
If you want to execute it
tedleonard — 2013-09-10T10:19:17-04:00 — #4
Thanks, I was instructed by my webhost's techsupport to use -c but I agree I think they must have meant to use -l. Using -l both files checked out with no syntax errors. Not sure what is going on here. Thanks for your help!