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 »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Import / Export API CLI Script Problems
Pages: [1]

Author Topic: Import / Export API CLI Script Problems  (Read 901 times)

bpmccain

  • I post frequently
  • ***
  • Posts: 255
  • Karma: 5
  • CiviCRM version: 4.1
  • CMS version: Drupal 7.12
  • MySQL version: 5.2
  • PHP version: 5.2
Import / Export API CLI Script Problems
July 04, 2011, 08:28:38 am
I've managed to figure out the API to some extent and am now successfully using it to import contacts by executing a php file through the CLI.

However, I am still struggling to follow along with Xavier's guide here:
http://civicrm.org/blogs/xavier/api_batch_tools

When I run the following code:

Code: [Select]
php bin/csv/import.php -uadmin -pmypassword -sdefault Tag /tmp/tag.csv
I get the following error message:

Code: [Select]
Cannot redeclare _PEAR_call_destructor() (previously declared in C:\xampp\php\PEAR\PEAR.php:773) in C:\xampp\htdocs\drupal\sites\all\modules\civicrm\packages\PEAR.php on line 811
Any ideas here? Thanks

Brian


mcarson

  • I post occasionally
  • **
  • Posts: 110
  • Karma: 5
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 7.x
  • MySQL version: 5.5
  • PHP version: 5.4.22
Re: Import / Export API CLI Script Problems
July 04, 2011, 09:50:11 am
Not sure how this works in xampp, but it looks as if PHP is loading pear by default when CiviCRM uses it's own under the /packages/ directory.
Maybe reconfigure PHP in xampp to NOT load pear???
“Anyone who has never made a mistake has never tried anything new.” - Albert Einstein
"If you are travelling at the speed of light and you turn on your headlights, would they work?" - Unknown

bpmccain

  • I post frequently
  • ***
  • Posts: 255
  • Karma: 5
  • CiviCRM version: 4.1
  • CMS version: Drupal 7.12
  • MySQL version: 5.2
  • PHP version: 5.2
Re: Import / Export API CLI Script Problems
July 04, 2011, 10:31:49 am
Thanks mcarson. I thought that might have something to do with it but I wasn't sure.

So I disabled PEAR in xampp. The next error I got was to do with not being able to find Console/Getopt.php, so I had to redefine the path to that in cli.php.

After that, I got an error saying it couldn't find PEAR.php from getopt.php, so I had to redefine the path to PEAR.php in that getopt.php.

So now I am getting the following error:
Code: [Select]
Usage: Please define CIVICRM_CONFDIR in settings_location.php at the top level civicrm directory
I understand that this has to do with the civicrm installation not being able to find the config file, but I have installed everything in the default location. My civicrm root is at /drupal/sites/all/modules/civicrm, and my civicrm.settings.php file is located under /drupal/sites/default/.

Any further ideas?

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Import / Export API CLI Script Problems
July 04, 2011, 10:39:50 am
Your path seems to be wrong somewhere.

It might be that the way it's defined on windows is different than for linux ? Would be great if you could investigate

add a file settings_location.php in the root of civicrm
Code: [Select]
<?
define( 'CIVICRM_CONFDIR', '/var/www/whereyouputdrupal/sites' );
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

bpmccain

  • I post frequently
  • ***
  • Posts: 255
  • Karma: 5
  • CiviCRM version: 4.1
  • CMS version: Drupal 7.12
  • MySQL version: 5.2
  • PHP version: 5.2
Re: Import / Export API CLI Script Problems
July 04, 2011, 11:09:26 am
That did it. Not sure why it is happening, but there is something weird going on with path's in my installation as you said.

I'll be transferring it over shortly to VPS instead of running it locally on xampp, so I will see if the problem persists, or if it is something to do with xampp.

Thanks again.

mcarson

  • I post occasionally
  • **
  • Posts: 110
  • Karma: 5
  • CiviCRM version: 4.4.4
  • CMS version: Drupal 7.x
  • MySQL version: 5.5
  • PHP version: 5.4.22
Re: Import / Export API CLI Script Problems
July 04, 2011, 11:36:50 am
Be careful with the Apache, PHP and MySQL setup if you are using ANY control panel. Especially with FastCGI/suExec and file/folder permissions.
I finally got it working perfectly without resorting to using suphp or lowering security... Let me know if you need any pointers (or check the docs in a couple of days for the full spec)
“Anyone who has never made a mistake has never tried anything new.” - Albert Einstein
"If you are travelling at the speed of light and you turn on your headlights, would they work?" - Unknown

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Import / Export API CLI Script Problems

This forum was archived on 2017-11-26.