Cron Jobs Setup correctly but getting these errors

TonyQ

New Member
/bin/bash: -c: line 0: syntax error near unexpected token `newline'

/bin/bash: -c: line 0: `/usr/bin/php -q /home/reviews/public_html/mailer/apps/console/console.php send-campaigns >'
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Here's the cron from Cpanel:
/usr/bin/php -q /home/reviews/public_html/mailer/apps/console/console.php send-campaigns >


I left out the /dev/null 2>&1 to debug normally it would be /usr/bin/php -q /home/reviews/public_html/mailer/apps/console/console.php send-campaigns >/dev/null 2>&1

Note: I can send emails manually when I preview the templates so its not the mail servers just can't get any of the cron jobs to work.
 
Try to send from command line with send-campaign command and see campaign sending emails or not.
 
syntax error near unexpected token `newline'
Make sure that when you cut and paste it from an editor that there is no line break included, so put it all on one line before you copy.
Also check where your php exe is with
which php-cli
and if that returns nothing usable at all, then check
which php
Then use that in your cron command.
 
I'm not a linux guy but I do have shell access what command do I use can you give me an example

getting the same error on all cron jobs

/bin/bash: -c: line 0: syntax error near unexpected token `newline'

/bin/bash: -c: line 0: `/usr/bin/php -q /home/reviews/public_html/mailer/apps/console/console.php hourly >'
 
Last edited:
Is this how your prompt looks like before you put in a command?
"/bin/bash: -c: line 0:"
It normally looks like this
"[root@...~]#"
(without quotation marks)
In any case, type there
"which php-cli"
or
"whereis php-cli"
and that should show you the exact location of the php exe to use (e.g. "/usr/bin/php-cli").
Then use that for the cron sending command, e.g.
/usr/bin/php-cli -q /home/reviews/public_html/mailer/apps/console/console.php send-campaigns >/dev/null 2>&1
as well as for the manual sending command
/usr/bin/php-cli -q /home/reviews/public_html/mailer/apps/console/console.php send-campaigns

Also, consider, this is rather a server, ie bash setup problem, not a mwz problem, see here:
https://www.google.co.uk/search?q="/bin/bash:+-c:+line+0:"
Odd though, as this usually does not happen on a cpanel server.

Come back with exact outputs, so that further help can be as specific as possible.
 
[reviews@this ~]$ which php-cli
/usr/bin/which: no php-cli in (/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/opt/cpanel/composer/bin:/home/reviews/.local/bin:/home/reviews/bin)
[reviews@this ~]$
 
This is from hosting tech support:

PHP cli is at /usr/local/bin/php
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

So I should use this for the Cron job?
/usr/local/bin/php -q /home/reviews/public_html/mailer/apps/console/console.php send-campaigns >/dev/null 2>&1


Still getting error:


/bin/bash: -c: line 0: syntax error near unexpected token `newline'

/bin/bash: -c: line 0: `/usr/local/bin/php -q /home/reviews/public_html/mailer/apps/console/console.php send-campaigns >'
 
Last edited:
/usr/local/bin/php -q /home/reviews/public_html/mailer/apps/console/console.php send-campaigns >/dev/null 2>&1
looks right

Is this a shared server or a vps/dedicated?
What host is it? Never had such problems on a cpanel/whm server. If you have not done much yet, perhaps a good time to go for another host?
Some good ones are in the third party section of the forum.
 
looks right

Is this a shared server or a vps/dedicated?
What host is it? Never had such problems on a cpanel/whm server. If you have not done much yet, perhaps a good time to go for another host?
Some good ones are in the third party section of the forum.
its a shared account on a dedicated server using WHM/Cpanel the Noc is first class been with them for 16 years ... the techs are looking into the issue too .
 
Issue resolved turns out the server striped the context of the php file when we uploaded the application ... the file was on the server with no content ... back to basics some times helps :)
 
Back
Top