Answers.Body: <p>Since you've confirmed the file exists (for future readers - the <code>vendor</code> folder can be inside the <code>web</code> folder or as a sibling - make sure you get it right!) this has to be a file permission user.</p>
  <ul>
  <li>Determine which user your PHP runs as.</li>
  <li>Recursively change the owner and permissions on the <code>vendor/civicrm</code> folder to give that user access.</li>
  </ul>
  <p>File ownership and permissions varies by operating system and is out of scope for this Stack Exchange, but there are many articles on the topic online.</p>
  <p>There are several ways to determine what user your PHP is running under, and it varies by OS and hosting company.  However, copying the permissions and owners of the other Drupal files should give you a workable configuration.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-23T23:05:37.737Z
Answers.Text: unfortunately this does not appear to be the answer to my problem. I am running Amazon Linux and used `php -r "echo exec('whoami');"` to verify that my PHP user is ec2-user.  I ran `chown` to make sure that ec2-user is the owner for all files recursively.  The main CiviCRM application can run so PHP has access to some CivCRM files. This and any further ideas are greatly appreciated.
Answers.UserDisplayName: Drupal Learner
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-26T15:55:44.217Z
Answers.Text: Your CLI user and your mod_php (or php-fpm) user aren't necessarily the same. Create a page that calls `phpinfo()` and view that in your browser?
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-26T17:35:41.640Z
Answers.Text: @johon-g-megaphone-tech, you were right that they were running as different users.  I changed my FPM config and both CLI  and the web use the ec2-user to run. Unfortunately, this did not solve the problem. I may have found the problem. I am making this two posts as it is otherwise too long.
Answers.UserDisplayName: Drupal Learner
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-26T17:39:42.353Z
Answers.Text: John, thank you for your help with this. This is where I think the problem is.  In my civicrm.settings I have $civicrm_root as /var/www/user/vendor/civicrm/civicrm-core/. It looks like I have two vendor directories one at the location above and one inside my web (Drupal root) directory. I am not sure how I got two directories or how CiviCRM would use what it is not defined.  I have what appears to be a fix by adding a sim link from web/vendor to ../vendor where it should be.
Answers.UserDisplayName: Drupal Learner
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-26T18:15:13.637Z
Answers.Text: @DrupalLearner I strongly recommend moving the folder rather than using symlinks - symlinks aren't treated uniformly across all environments (e.g. Apache's `FollowSymlinks` directive).  There are several folks who provide instructions on moving `/web/vendor` to `/vendor`, e.g. step 6 on https://www.skillmaticace.com/blog/how-change-managing-drupal-8-and-drupal-9-sites-manual-composer-based.
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-01-08T22:10:35.237Z
Answers.Text: @ Jon G - Megaphone Tech, thank you for the additional information.  I will look into this.  Thanks! I know I typed this funny it kept taking out Jon's name if I made it an @ reference.
Answers.UserDisplayName: Drupal Learner
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-12-22T18:53:09.980Z
Answers.LastActivityDate: 2022-12-22T18:53:09.980Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Body: <p>After upgrading to PHP 8 (8.0.25) my CiviCRM install fails to be able to find /var/www/user/web/vendor/civicrm/civicrm-core/install/langs.php. This happens whenever I try and go to a /admin* page in Drupal.</p>
  <p>There is an error in the Drupal Watchdog log and a warning given by PHP.</p>
  <p>The PHP warning is &quot;Warning: require(/var/www/user/web/vendor/civicrm/civicrm-core/install/langs.php): Failed to open stream: No such file or directory in /var/www/user/vendor/civicrm/civicrm-core/setup/plugins/init/AvailableLangs.civi-setup.php on line 22.&quot;</p>
  <p>The complete error message from Drupal Watchdog is - &quot;Failed opening required ''/var/www/user/web/vendor/civicrm/civicrm-core/install/langs.php'' (include_path=''.:/var/www/user/web/vendor/civicrm/civicrm-core:/var/www/user'&quot;</p>
  <p>I have Drupal 9.3.6 and CiviCRM 5.55.2.</p>
  <p>Summary Fields and NCN Civirules Actions for Zoom need to be updated to work with PHP 8 but they are both disabled.</p>
  <p>I have verified that the file (langs.php) does exists at the location shown in the error message. I have also made sure that the file is not blank.</p>
  <p>Any help is greatly appreciated.</p>
  <p>Thanks!</p>
  
Tags: <drupal><php><php8>
Title: PHP Cannot Find File From Vendor Directory
ThreadText: # PHP Cannot Find File From Vendor Directory
  
  (Asked by: username_0 on 2022-12-21)
  
  After upgrading to PHP 8 (8.0.25) my CiviCRM install fails to be able to find /var/www/user/web/vendor/civicrm/civicrm-core/install/langs.php. This happens whenever I try and go to a /admin\* page in username_0.
  
  There is an error in the username_0 Watchdog log and a warning given by PHP.
  
  The PHP warning is "Warning: require(/var/www/user/web/vendor/civicrm/civicrm-core/install/langs.php): Failed to open stream: No such file or directory in /var/www/user/vendor/civicrm/civicrm-core/setup/plugins/init/AvailableLangs.civi-setup.php on line 22."
  
  The complete error message from username_0 Watchdog is - "Failed opening required ''/var/www/user/web/vendor/civicrm/civicrm-core/install/langs.php'' (include\_path=''.:/var/www/user/web/vendor/civicrm/civicrm-core:/var/www/user'"
  
  I have username_0 9.3.6 and CiviCRM 5.55.2.
  
  Summary Fields and NCN Civirules Actions for Zoom need to be updated to work with PHP 8 but they are both disabled.
  
  I have verified that the file (langs.php) does exists at the location shown in the error message. I have also made sure that the file is not blank.
  
  Any help is greatly appreciated.
  
  Thanks!
  
  **Tags:** drupal, php, php8
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-12-22. Score: 2
  
  Since you've confirmed the file exists (for future readers - the `vendor` folder can be inside the `web` folder or as a sibling - make sure you get it right!) this has to be a file permission user.
  
  * Determine which user your PHP runs as.
  * Recursively change the owner and permissions on the `vendor/civicrm` folder to give that user access.
  
  File ownership and permissions varies by operating system and is out of scope for this Stack Exchange, but there are many articles on the topic online.
  
  There are several ways to determine what user your PHP is running under, and it varies by OS and hosting company. However, copying the permissions and owners of the other username_0 files should give you a workable configuration.
  
  > **Comments:**
  > **username_0**: unfortunately this does not appear to be the answer to my problem. I am running Amazon Linux and used `php -r "echo exec('whoami');"` to verify that my PHP user is ec2-user.  I ran `chown` to make sure that ec2-user is the owner for all files recursively.  The main CiviCRM application can run so PHP has access to some CivCRM files. This and any further ideas are greatly appreciated.  
  > **username_1**: Your CLI user and your mod_php (or php-fpm) user aren't necessarily the same. Create a page that calls `phpinfo()` and view that in your browser?  
  > **username_0**: @johon-g-megaphone-username_1, you were right that they were running as different users.  I changed my FPM config and both CLI  and the web use the ec2-user to run. Unfortunately, this did not solve the problem. I may have found the problem. I am making this two posts as it is otherwise too long.  
  > **username_0**: John, thank you for your help with this. This is where I think the problem is.  In my civicrm.settings I have $civicrm_root as /var/www/user/vendor/civicrm/civicrm-core/. It looks like I have two vendor directories one at the location above and one inside my web (username_0 root) directory. I am not sure how I got two directories or how CiviCRM would use what it is not defined.  I have what appears to be a fix by adding a sim link from web/vendor to ../vendor where it should be.  
  > **username_1**: @username_0 I strongly recommend moving the folder rather than using symlinks - symlinks aren't treated uniformly across all environments (e.g. Apache's `FollowSymlinks` directive).  There are several folks who provide instructions on moving `/web/vendor` to `/vendor`, e.g. step 6 on https://www.skillmaticace.com/blog/how-change-managing-username_0-8-and-username_0-9-sites-manual-composer-based.  
  > **username_0**: @ Jon G - Megaphone username_1, thank you for the additional information.  I will look into this.  Thanks! I know I typed this funny it kept taking out Jon's name if I made it an @ reference.  
  
  ---
  
  