Answers.Body: <p>My read on this error doesn't suggest it's trying to write to <code>/usr/local/bin/civix</code> - just that the files that are calling <code>mkdir()</code> and <code>file_put_contents()</code> are located there.</p>
  
  <p>If you call <code>civix</code> to generate a module, it will create it in the current working directory.  Check the permissions of the current directory.  If that's not conclusive, you can update the question.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-15T02:29:18.703Z
Answers.LastActivityDate: 2017-08-15T02:29:18.703Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Body: <p>I've been following the instructions to create a new extension and get the following errors when I run the civix generate:module command:</p>
  
  <blockquote>
    <p>civix generate:module org.civicrm.searchbuilderlocation</p>
  </blockquote>
  
  <p>License set to AGPL-3.0 (authored by Adam Zilkie )
  If this is in error, please correct info.xml and LICENSE.txt
  Initalize module org.civicrm.searchbuilderlocation
  PHP Warning:  mkdir(): Permission denied in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/Dirs.php on line 34</p>
  
  <p>Warning: mkdir(): Permission denied in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/Dirs.php on line 34
  PHP Warning:  mkdir(): Permission denied in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/Dirs.php on line 34</p>
  
  <p>Warning: mkdir(): Permission denied in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/Dirs.php on line 34
  PHP Warning:  mkdir(): Permission denied in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/Dirs.php on line 34</p>
  
  <p>Warning: mkdir(): Permission denied in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/Dirs.php on line 34
  PHP Warning:  mkdir(): Permission denied in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/Dirs.php on line 34</p>
  
  <p>Warning: mkdir(): Permission denied in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/Dirs.php on line 34
  Write org.civicrm.searchbuilderlocation/info.xml
  PHP Warning:  file_put_contents(org.civicrm.searchbuilderlocation/info.xml): failed to open stream: No such file or directory in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/XML.php on line 71</p>
  
  <p>Warning: file_put_contents(org.civicrm.searchbuilderlocation/info.xml): failed to open stream: No such file or directory in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/XML.php on line 71
  Write org.civicrm.searchbuilderlocation/searchbuilderlocation.php
  PHP Warning:  file_put_contents(org.civicrm.searchbuilderlocation/searchbuilderlocation.php): failed to open stream: No such file or directory in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/Template.php on line 48</p>
  
  <p>Warning: file_put_contents(org.civicrm.searchbuilderlocation/searchbuilderlocation.php): failed to open stream: No such file or directory in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/Template.php on line 48
  Write org.civicrm.searchbuilderlocation/searchbuilderlocation.civix.php
  PHP Warning:  file_put_contents(org.civicrm.searchbuilderlocation/searchbuilderlocation.civix.php): failed to open stream: No such file or directory in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/Template.php on line 48</p>
  
  <p>Warning: file_put_contents(org.civicrm.searchbuilderlocation/searchbuilderlocation.civix.php): failed to open stream: No such file or directory in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/Template.php on line 48
  Write org.civicrm.searchbuilderlocation/LICENSE.txt
  PHP Warning:  file_put_contents(org.civicrm.searchbuilderlocation/LICENSE.txt): failed to open stream: No such file or directory in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/License.php on line 51</p>
  
  <p>Warning: file_put_contents(org.civicrm.searchbuilderlocation/LICENSE.txt): failed to open stream: No such file or directory in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/License.php on line 51</p>
  
  <p>mkdir(): Permission denied in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/Dirs.php on line 34</p>
  
  <p>It looks like it is trying to install files in /usr/local/bin/civix which is the binary location. Do I need to set a PATH variable to tell where to install files?</p>
  
  <p>Thanks</p>
  
Tags: <extension><civix>
Title: civix permission denied errors in /usr/local/bin when generating a skeltal extension
ThreadText: # civix permission denied errors in /usr/local/bin when generating a skeltal extension
  
  (Asked by: username_0 on 2017-08-14)
  
  I've been following the instructions to create a new extension and get the following errors when I run the civix generate:module command:
  
  > civix generate:module org.civicrm.searchbuilderlocation
  
  License set to AGPL-3.0 (authored by username_0 )
  If this is in error, please correct info.xml and LICENSE.txt
  Initalize module org.civicrm.searchbuilderlocation
  PHP Warning: mkdir(): Permission denied in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/Dirs.php on line 34
  
  Warning: mkdir(): Permission denied in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/Dirs.php on line 34
  PHP Warning: mkdir(): Permission denied in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/Dirs.php on line 34
  
  Warning: mkdir(): Permission denied in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/Dirs.php on line 34
  PHP Warning: mkdir(): Permission denied in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/Dirs.php on line 34
  
  Warning: mkdir(): Permission denied in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/Dirs.php on line 34
  PHP Warning: mkdir(): Permission denied in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/Dirs.php on line 34
  
  Warning: mkdir(): Permission denied in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/Dirs.php on line 34
  Write org.civicrm.searchbuilderlocation/info.xml
  PHP Warning: file\_put\_contents(org.civicrm.searchbuilderlocation/info.xml): failed to open stream: No such file or directory in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/XML.php on line 71
  
  Warning: file\_put\_contents(org.civicrm.searchbuilderlocation/info.xml): failed to open stream: No such file or directory in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/XML.php on line 71
  Write org.civicrm.searchbuilderlocation/searchbuilderlocation.php
  PHP Warning: file\_put\_contents(org.civicrm.searchbuilderlocation/searchbuilderlocation.php): failed to open stream: No such file or directory in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/Template.php on line 48
  
  Warning: file\_put\_contents(org.civicrm.searchbuilderlocation/searchbuilderlocation.php): failed to open stream: No such file or directory in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/Template.php on line 48
  Write org.civicrm.searchbuilderlocation/searchbuilderlocation.civix.php
  PHP Warning: file\_put\_contents(org.civicrm.searchbuilderlocation/searchbuilderlocation.civix.php): failed to open stream: No such file or directory in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/Template.php on line 48
  
  Warning: file\_put\_contents(org.civicrm.searchbuilderlocation/searchbuilderlocation.civix.php): failed to open stream: No such file or directory in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/Template.php on line 48
  Write org.civicrm.searchbuilderlocation/LICENSE.txt
  PHP Warning: file\_put\_contents(org.civicrm.searchbuilderlocation/LICENSE.txt): failed to open stream: No such file or directory in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/License.php on line 51
  
  Warning: file\_put\_contents(org.civicrm.searchbuilderlocation/LICENSE.txt): failed to open stream: No such file or directory in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/License.php on line 51
  
  mkdir(): Permission denied in phar:///usr/local/bin/civix/src/CRM/CivixBundle/Builder/Dirs.php on line 34
  
  It looks like it is trying to install files in /usr/local/bin/civix which is the binary location. Do I need to set a PATH variable to tell where to install files?
  
  Thanks
  
  **Tags:** extension, civix
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-08-15. Score: 0 | Accepted answer
  
  My read on this error doesn't suggest it's trying to write to `/usr/local/bin/civix` - just that the files that are calling `mkdir()` and `file_put_contents()` are located there.
  
  If you call `civix` to generate a module, it will create it in the current working directory. Check the permissions of the current directory. If that's not conclusive, you can update the question.
  
  
  ---
  
  