2

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.

There is an error in the Drupal 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 Drupal 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 Drupal 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!

1 Answer 1

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 Drupal files should give you a workable configuration.

6
  • 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. Commented Dec 23, 2022 at 23:05
  • 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? Commented Dec 26, 2022 at 15:55
  • @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. Commented Dec 26, 2022 at 17:35
  • 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. Commented Dec 26, 2022 at 17:39
  • @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 skillmaticace.com/blog/…. Commented Dec 26, 2022 at 18:15

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.