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) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Can't get bin/csv/export.php to work
Pages: [1]

Author Topic: Can't get bin/csv/export.php to work  (Read 2047 times)

arielqgold

  • I’m new here
  • *
  • Posts: 17
  • Karma: 1
  • CiviCRM version: 3.3.1, 3.3.5, 3.4.5
  • CMS version: Drupal 6.22
Can't get bin/csv/export.php to work
September 27, 2011, 05:44:37 pm
Using Civicrm 3.4.5 with Drupal 6

I tried:
Code: [Select]
/sites/all/modules/civicrm# php bin/csv/export.php -uusername -ppass -ssitedomainname Contact
and get this error:
Code: [Select]
Usage: Please define CIVICRM_CONFDIR in settings_location.php at the top level civicrm directory
So I put settings_location.php in civicrm_root per instructions in bin/cli.php  and ran export.php and get:

Code: [Select]
PHP Warning:  session_start(): Cannot send session cookie - headers already sent by (output started at /path/to/drupal/sites/all/modules/civicrm/settings_location.php:7) in /path/to/drupal/civicrm-3.4.5/sites/all/modules/civicrm/bin/cli.php on line 85

Don't know if this is related, but i defined CIVICRM_CONFDIR as 'path/to/drupal/sites' but noticed that on line 116 in bin/cli.php:
Code: [Select]
   $_SERVER['SCRIPT_FILENAME' ] = CIVICRM_CONFDIR . "/sites/all/modules/civicrm/bin/cli.php";
it includes sites..I tried to define CIVICRM_CONFDIR with and without sites but neither worked. Without sites I get more errors.

Code: [Select]
PHP Warning:  include_once(/path/to/drupal/default/civicrm.settings.php): failed to open stream: No such file or directory in /data/disk/octopus/distro/003/civicrm-3.4.5/sites/all/modules/civicrm/civicrm.config.php on line 110
PHP Warning:  include_once(): Failed opening '/path/to/drupal/default/civicrm.settings.php' for inclusion (include_path='packages/:.:/usr/local/lib/php') in /path/to/drupal/sites/all/modules/civicrm/civicrm.config.php on line 110
PHP Warning:  session_start(): Cannot send session cookie - headers already sent by (output started at /path/to/drupal/sites/all/modules/civicrm/settings_location.php:7) in /path/to/drupal/sites/all/modules/civicrm/bin/cli.php on line 85

As a side note, I just ran bin/UpdateGreeting.php successfully via the command line.

Thank you for any help.
« Last Edit: September 28, 2011, 11:38:47 am by arielqgold »

Chris Burgess

  • Ask me questions
  • ****
  • Posts: 675
  • Karma: 59
Re: Can't get bin/csv/export.php to work
September 27, 2011, 05:54:03 pm
Quote
Don't know if this is related, but i defined CIVICRM_CONFDIR as 'path/to/drupal/sites' but noticed that on line 116 in bin/cli.php:

settings_location.php should contain the complete path to the CiviCRM site configuration directory, not the relative path. It must start with a slash.

Code: [Select]
<?php define('CIVICRM_CONFDIR', '/path/to/drupal/sites/default');
Quote
PHP Warning:  session_start(): Cannot send session cookie - headers already sent by (output started at /path/to/drupal/sites/all/modules/civicrm/settings_location.php:7) in /path/to/drupal/civicrm-3.4.5/sites/all/modules/civicrm/bin/cli.php on line 85

This suggests that settings_location.php has already output something. Check that your file has nothing outside the <?php ?> tags. (I omit the closing tag, myself.)

Quote
PHP Warning:  include_once(/path/to/drupal/default/civicrm.settings.php): failed to open stream: No such file or directory in /data/disk/octopus/distro/003/civicrm-3.4.5/sites/all/modules/civicrm/civicrm.config.php on line 110

So it looks like you want,

Code: [Select]
<?php define('CIVICRM_CONFDIR', '/data/disk/octopus/distro/003/civicrm-3.4.5/sites/SITENAME');
« Last Edit: September 27, 2011, 05:57:04 pm by grobot »
@xurizaemon ● www.fuzion.co.nz

arielqgold

  • I’m new here
  • *
  • Posts: 17
  • Karma: 1
  • CiviCRM version: 3.3.1, 3.3.5, 3.4.5
  • CMS version: Drupal 6.22
Re: Can't get bin/csv/export.php to work
September 27, 2011, 06:04:24 pm
Before you posted your reply I removed the trailling ?> in settings_location.php and that got rid of the error.

I then tried your recommendation to include the SITENAME in settings_location.php and still get no output and no error.

jtbayly

  • I post occasionally
  • **
  • Posts: 43
  • Karma: 0
Re: Can't get bin/csv/export.php to work
October 21, 2011, 10:17:32 am
I also get no output and no error. Neither import nor export does anything.

If I change the username or password or website, it gives an error, so I know those are correct. I've done the exact examples that Xavier gives, and also tried other entities.

Export creates an empty file. Import doesn't do anything.

Did you ever get this fixed?

arielqgold

  • I’m new here
  • *
  • Posts: 17
  • Karma: 1
  • CiviCRM version: 3.3.1, 3.3.5, 3.4.5
  • CMS version: Drupal 6.22
Re: Can't get bin/csv/export.php to work
November 14, 2011, 01:49:25 pm
There was a bug that's been fixed. Not sure where the patch is, but if you install latest from svn it should work.
« Last Edit: November 14, 2011, 01:51:33 pm by arielqgold »

jtbayly

  • I post occasionally
  • **
  • Posts: 43
  • Karma: 0
Re: Can't get bin/csv/export.php to work
November 29, 2011, 11:26:28 am
Not sure how I missed your response until just now. Thanks for the answer.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • Can't get bin/csv/export.php to work

This forum was archived on 2017-11-26.