1

I have installed civicrm and want to develop an extension. I installed civix for creating this extension but when i run civix civicrm:ping command in my civicrm folder, I get the following error:

C:\xamp\htdocs\civicrm>civix civicrm:ping

[RuntimeException]

Failed to determine INI file path.

How to solve this problem?

2
  • 1
    Is CiviCRM working in your browser? Did you install CiviCRM with civicrm-buildkit, or manually? What CMS are you using? Commented Mar 13, 2017 at 6:19
  • Yes it's working on my local host. Using Drupal. didn't install any buildkit, will do that on cent os server. Commented Mar 13, 2017 at 17:12

3 Answers 3

4

I was just dealing with this and found your question..

Since you used C:\, i'll assume you're in windows.

TLDR; Try checking your PHP environment variable for 'HOMEPATH' vs 'HOME' and editing the file I mention below.

The first thing I will say is that you can increase verbosity of errors in civix by using -v, -vv, or -vvv options for most verbose. It helped me a lot with this issue.

I will leave the important details of my environment here as well, for others who may find this question:

A working Drupal 7 + CiviCRM 4.7.17 locally installed (manually) with MAMP on a Windows 10 machine, configured to use PHP 5.6.28. MAMP is installed to C:/MAMP and the site root is C:/MAMP/htdocs/drupal/

Civix is installed to C:/Users/"Eli Lisseck"/ and I am seeing the same behavior as you that civicrm:ping throws and exception.

Running the more verbose command civix civicrm:ping -vvv led me to the file C:\Users\Eli Lisseck\civix\vendor\civicrm\cv\src\Config.php line 54.

Check if it is looking for your HOME environment variable correctly, versus what you have under environment variables when you run php -i. I found it was only looking for 'HOME' but what existed was 'HOMEPATH'... so I added at line 52:

elseif (getenv('HOMEPATH')) {
      $file = getenv('HOMEPATH') . '/.cv.json';
      return $file;
    }

Now I get civix civicrm:ping Ping successful

Hope this is helpful!

1
  • perfect solution!
    – davejal
    Commented Jul 11, 2017 at 20:41
2

I was about to take Eli's approach, but then I realized it is much simpler:

  1. close your current cmd shell/terminal;
  2. press Win + R, type setx CV_CONFIG "%userprofile%\.cv.json" and press Enter;
  3. reopen the shell, goto your project's directory and test with civix civicrm:ping -vvv.

Alternatively, if you prefer to check/set environment variables for your account, run:

  • %windir%\system32\rundll32.exe sysdm.cpl EditEnvironmentVariables

Why?

If you notice civix\vendor\civicrm\cv\src\Config.php@getFileName(), the first environment variable that it expects is CV_CONFIG, and when it doesn't find it, it will try getenv('HOME') . '/.cv.json'.

Therefore, you can either set the new variable I mentioned above or just:

  • setx HOME %userprofile%.
0
1

Shortcut to Eli's answer; just civix civicrm:ping -vvv and check for ...\civix\vendor\civicrm\cv\src\Config.php. If you find it, it means you need to change HOME to HOMEPATH.

From

elseif (getenv('HOME')) {
  return getenv('HOME') . '/.cv.json';
}

to

elseif (getenv('HOMEPATH')) {
  return getenv('HOMEPATH') . '/.cv.json';
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.