CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • Error message "Fatal error: cli.php can only be run from command line"
Pages: [1]

Author Topic: Error message "Fatal error: cli.php can only be run from command line"  (Read 1110 times)

gstuessy

  • I’m new here
  • *
  • Posts: 3
  • Karma: 0
  • CiviCRM version: 4.3.5
  • CMS version: WordPress 3.8.1
  • MySQL version: 5.5.34-cll-lve
  • PHP version: 5.3.27
Error message "Fatal error: cli.php can only be run from command line"
March 01, 2014, 12:35:20 pm
In CiviCRM with Wordpress, I am trying to have scheduled mailings sent every time the cron job runs. I have set up in CPanel a cron job to run every minute, with the following command line:

"php /home/.../civicrm/civicrm/bin/cli.php -s [website] -u [username] -p [password] -e Job -a execute"

and it sent me an email with this error:

"Fatal error:  cli.php can only be run from command line"

Does anyone know how to set up the mailings so that they go out when the cron job runs?

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
Re: Error message "Fatal error: cli.php can only be run from command line"
March 03, 2014, 07:06:26 am
Try using the GET or WGET command to run the mailing.

Also not sure why you are trying to run a specific job in this case.  Execute cron.php and it will trigger the consolidated cron script and run all configured Scheduled Jobs.
Try CiviTeacher: the online video tutorial CiviCRM learning library.

Ann

  • I’m new here
  • *
  • Posts: 6
  • Karma: 0
  • CiviCRM version: 4.4
  • CMS version: Drupal
  • MySQL version: 5.6
  • PHP version: 5.5
Re: Error message "Fatal error: cli.php can only be run from command line"
March 15, 2014, 11:34:29 pm
A convenient way to go: http://www.easycron.com/tutorials/how-to-set-up-cron-job-for-civicrm

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Error message "Fatal error: cli.php can only be run from command line"
March 16, 2014, 03:23:06 am
Hi,

You should check if your server has php-cli properly configured. if you run php -v it should output

PHP 5.4.9-4ubuntu2.4 (cli) (built: Dec 12 2013 04:29:20)

It should contain "cli", not "cgi"

And you should update your civi, it reminds me a problem we fixed.

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

gstuessy

  • I’m new here
  • *
  • Posts: 3
  • Karma: 0
  • CiviCRM version: 4.3.5
  • CMS version: WordPress 3.8.1
  • MySQL version: 5.5.34-cll-lve
  • PHP version: 5.3.27
Re: Error message "Fatal error: cli.php can only be run from command line"
March 22, 2014, 11:14:59 am
Thank you, xavier.

Here is the output of that command. I think it is correct.

PHP 5.3.27 (cli) (built: Jan  2 2014 07:19:48)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies
    with the ionCube PHP Loader v4.4.1, Copyright (c) 2002-2013, by ionCube Ltd., and
    with Zend Guard Loader v3.3, Copyright (c) 1998-2010, by Zend Technologies

When I run this command from the command prompt, I don't see any output but my emails aren't sent:

php /home../public_html/wp-content/plugins/civicrm/civicrm/bin/cli.php -s [site] -u [user] -p [password] -a execute -e Job

I also tried the URL version and that didn't work either.

Is there anything I'm doing wrong?
« Last Edit: March 22, 2014, 11:16:39 am by gstuessy »

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviMail (Moderator: Piotr Szotkowski) »
  • Error message "Fatal error: cli.php can only be run from command line"

This forum was archived on 2017-11-26.