Answers.Body: <p>Welcome to civicrm stackexchange. </p>
  
  <p>Couple of options here. </p>
  
  <ol>
  <li>One option is to split your file into smaller chunks. </li>
  <li>If you have the ability to alter the php settings on the server you can change
  these to increase the time over which the import can run the option
  you probably want to look at is max_execution_time  - in your php
  ini file. Depending on your hosting this will be in different
  places.</li>
  <li>Depending on whether your site is live or not - if you are in the set up stage you could always look at exporting your site to a local machine which you can edit the php ini on. then copy the database back - however if you don't have a local dev environment set up this might require a lot of set up.</li>
  <li>If you want to dive into the code - then you'll need to write some custom code to do this. You are probably best to import via the api - that way you can let civicrm take care of making sure everything in the database matches up correctly.  As a first step I'd checkout the api explorer under Support -> Developer Api Explorer v3. You might want to check <a href="https://github.com/eileenmcnaughton/nz.co.fuzion.csvimport" rel="nofollow noreferrer">https://github.com/eileenmcnaughton/nz.co.fuzion.csvimport</a> for inspiration  -> and don't forget you'll need to call civicrm_initialize() prior to making an api call. You can use drush,wp or cv to evaluate a file against the site.</li>
  </ol>
  
  <p>If you really wanted to court disaster you could try importing contacts directly into the sql tables - but I wouldn't recommend this as a first step. </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-30T20:27:04.140Z
Answers.Text: I strongly recommend not importing with SQL.  This bypasses a great deal of validation, greeting/display name processing, geocoding, and more.
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-01T21:00:14.553Z
Answers.Text: Totally agree have edited to remove some of the details.
Answers.UserDisplayName: Luke Stewart
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-28T04:18:51.190Z
Answers.LastActivityDate: 2019-12-01T20:59:45.077Z
Answers.LastEditDate: 2019-12-01T20:59:45.077Z
Answers.UserDisplayName: Luke Stewart
Body: <p>Can some one give a code to how to import contacts in civicrm by using script line command. I a have a 45000 contacts and importing from civicrm interface i am getting gateway timeout error. I need help in importing contacts from CLI.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-11-27T18:32:53.323Z
Comments.Text: I don't understand why you tagged this as webform-civicrm
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-11-28T01:12:58.647Z
Comments.Text: removed that tag
Comments.UserDisplayName: KarinG - Semper IT
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-11-30T20:29:08.570Z
Comments.Text: Possible duplicate of [How do I import contacts through the command line?](https://civicrm.stackexchange.com/questions/4723/how-do-i-import-contacts-through-the-command-line)
Comments.UserDisplayName: Jon G - Megaphone Tech
Tags: <contacts><import>
Title: script cli code for importing contacts in civicrm
ThreadText: # script cli code for importing contacts in civicrm
  
  (Asked by: username_0 on 2019-11-27)
  
  Can some one give a code to how to import contacts in civicrm by using script line command. I a have a 45000 contacts and importing from civicrm interface i am getting gateway timeout error. I need help in importing contacts from CLI.
  
  **Tags:** contacts, import
  
  > **Comments:**
  > **username_1**: I don't understand why you tagged this as webform-civicrm  
  > **username_2**: removed that tag  
  > **username_3**: Possible duplicate of [How do I import contacts through the command line?](https://civicrm.stackexchange.com/questions/4723/how-do-i-import-contacts-through-the-command-line)  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_4 on 2019-11-28. Score: 2
  
  Welcome to civicrm stackexchange.
  
  Couple of options here.
  
  1. One option is to split your file into smaller chunks.
  2. If you have the ability to alter the php settings on the server you can change
     these to increase the time over which the import can run the option
     you probably want to look at is max\_execution\_time - in your php
     ini file. Depending on your hosting this will be in different
     places.
  3. Depending on whether your site is live or not - if you are in the set up stage you could always look at exporting your site to a local machine which you can edit the php ini on. then copy the database back - however if you don't have a local dev environment set up this might require a lot of set up.
  4. If you want to dive into the code - then you'll need to write some custom code to do this. You are probably best to import via the api - that way you can let civicrm take care of making sure everything in the database matches up correctly. As a first step I'd checkout the api explorer under Support -> Developer Api Explorer v3. You might want to check <https://github.com/eileenmcnaughton/nz.co.fuzion.csvimport> for inspiration -> and don't forget you'll need to call civicrm\_initialize() prior to making an api call. You can use drush,wp or cv to evaluate a file against the site.
  
  If you really wanted to court disaster you could try importing contacts directly into the sql tables - but I wouldn't recommend this as a first step.
  
  > **Comments:**
  > **username_3**: I strongly recommend not importing with SQL.  This bypasses a great deal of validation, greeting/display name processing, geocoding, and more.  
  > **username_4**: Totally agree have edited to remove some of the details.  
  
  ---
  
  