Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 8 Hosting Upgrades #940

Open
8 of 11 tasks
larsdesigns opened this issue Sep 28, 2022 · 20 comments
Open
8 of 11 tasks

PHP 8 Hosting Upgrades #940

larsdesigns opened this issue Sep 28, 2022 · 20 comments
Assignees

Comments

@larsdesigns
Copy link
Contributor

larsdesigns commented Sep 28, 2022

The end of life for php 7 security support is November 28th 2022: https://www.php.net/supported-versions.php

I will be upgrade the servers to php 8.1. in the next few days. I will begin by upgrading the beta.backdropcms.org server first. After testing is successful, I will proceed with upgrading production. The beta.backdropcms.org VM is a clone of production and should be a great testing environment.

A list of sites from nginx configuration:

  • backdropcms.org
  • docs.backdropcms.org
  • sanitize.backdropcms.org
  • telemetry.backdropcms.org
  • updates.backdropcms.org
  • handbook.backdropcms.org
  • localize.backdropcms.org
  • backdrop-live.backdropcms.org
  • api.backdropcms.org
  • projects.backdropcms.org
  • forum.backdropcms.org
@larsdesigns larsdesigns self-assigned this Sep 28, 2022
@larsdesigns
Copy link
Contributor Author

@jenlampton, Are there any known PHP issues that you know of? I was unable to find any in backdrop-ops but I have not checked CiviCRM.

@jenlampton
Copy link
Member

It would surprise me if there weren't any, but I can't remember anything off hand.

@larsdesigns
Copy link
Contributor Author

I have replaced php 7.4 and php 7.2 with php 8.0 and tested the sites using an /etc/hosts entry on my workstation for the configuration domains.

@stpaultim, Would you be some kind as to help with testing?

@larsdesigns
Copy link
Contributor Author

larsdesigns commented Oct 11, 2022

Everything seems okay except that drush is giving an error.

Drush is at version 8 and the error is:

PHP Fatal error:  Array and string offset access syntax with curly braces is no longer supported in /home/backdrop/.composer/vendor/drush/drush/includes/command.inc on line 860

I installed drush 11 using composer but it will not run either. It is turning in to a late one so I will pick it up later today.

I restored the original drush files in the /home/backdrop directory for now.

Just a reminder that only the beta server is being worked on.

@larsdesigns
Copy link
Contributor Author

I was able to get drush installed and running on php8.0.

@jenlampton
Copy link
Member

@larsdesigns backdrop support for Drush only works for Drush 8 (so, no need to update to Drush 11, 10, or even 9). If we do ever run into issues with Drush 8, that would be a good time to switch to bee :)

@larsdesigns
Copy link
Contributor Author

It was decided today during the core developer meeting that I would proceed with replacing drush 8 with Backdrop CMS Bee: https://backdropcms.org/project/bee.

I will scan the other sites with the phpcs php 8 checker but I could probably use some help with testing those.

So far there have been no problems reported from Civi. I am getting close to coming to point where I can promote the PHP 8 updates to production.

@larsdesigns
Copy link
Contributor Author

Completed the following:

  1. Installed bee on the beta server and made it executable.
  2. Tested it by running a few commands and it seems to be working great.
    Screen Shot 2022-10-26 at 4 28 04 AM
  3. I will finish the phpcs scan of the other sites and if the results are okay, I will proceed with updating production this weekend.

@larsdesigns
Copy link
Contributor Author

I will be moving forward with the upgrade on production in a couple hours.

@larsdesigns
Copy link
Contributor Author

Completed the following tasks:

  1. Installed and configured PHP 8.0 using available Debian packages available via Aptitude.
  2. Updated the Nginx configuration to use PHP 8.0 FPM for each site and carefully migrated php.ini values from the php 7.4 configuration.
  3. I have temporarily left php 7.4-fpm running along side php 8.0-fpm just in case we run into a critical bug and need to revert quickly.
  4. Installed and configured the bee cli utility to be available for all users to execute. In installed bee in /home/backdrop/.bee and is sym linked to /usr/local/bin/bee as recommended in the installation instructions.
  5. Updated the OS packages and restarted the server.
  6. Checked the forum, events and backdropcms.org sites to make sure they are running, able to check for module updates and are using the intended php 8.0 configuration.

I will leave this ticket open for a little while and close it when I uninstall and clean off php 7.4 from the server.

Please report back any errors that are discovered and could potentially related to the upgrade.

@stpaultim
Copy link
Contributor

stpaultim commented Oct 31, 2022

@larsdesigns - The forum is not working, in that I am unable to comment on or post new topics in the forum. I assume this is related to the PHP upgrade.

We are getting the following errors:

Call to undefined function each()

This indicates to me that we might have an error in our code for the Forum that isn't PHP 8 compatible? I think we have some custom code there.

@klonos
Copy link
Member

klonos commented Oct 31, 2022

FTR: the problem is with the SMTP contrib module, and it is fixed by the PR here: backdrop-contrib/smtp#16

@larsdesigns
Copy link
Contributor Author

I have rolled back to 7.4 for all of the sites. Let's give it another go after smtp module is fixed.

Also, I found some changes that need to be made in the theme.

I found two calls to `each()` in template.php in the borg theme on lines 394 and and 414.

@larsdesigns
Copy link
Contributor Author

It looks like the recent release of the backdrop.org has been fixed and is compatible with PHP 8. I am going to update that site to PHP 8.1.

@larsdesigns
Copy link
Contributor Author

I have implemented php 8.1 for backdropcms.org and tested the smtp module by sending myself a password reset e-mail. It seems to be running okay.

I will work on evaluating the other sites for upgrade.

@larsdesigns
Copy link
Contributor Author

I have updated sanitize.backdropcms.org to use PHP 8.1 and checked the site. The sanitize script has been using 8.1 since last October.

@bugfolder
Copy link
Contributor

I just updated a module (ip) on b.org (which is on version 1.23.0) that required a db/config update, and running update.php issued a bunch of identical warnings:

Deprecated function: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in system_requirements() (line 472 of /home/backdrop/repo/www/core/modules/system/system.install).

@larsdesigns
Copy link
Contributor Author

I checked for the each() function in all of the sites and found the following usages:

╰─ grep -rni " each(" .
./docs/backdrop-code-to-index/core/misc/states.js:392:        // Break the each() loop if this is checked.
./docs/repo/www/core/misc/states.js:392:        // Break the each() loop if this is checked.
./docs/repo/www/modules/contrib/diff/DiffEngine.php:315:        while (list ($junk, $y) = each($matches)) {
./docs/repo/www/modules/contrib/diff/DiffEngine.php:323:        while (list ($junk, $y) = each($matches)) {
./localize/repo/www/sites/all/modules/contrib/l10n_server/l10n_community/welcome.inc:174:    list($language_code, $language_name) = each($language_list);
./localize/repo/www/sites/all/modules/contrib/smtp/smtp.phpmailer.inc:1637:    while ( list(, $line) = each($lines) ) {
./forum/repo/www/core/misc/states.js:392:        // Break the each() loop if this is checked.
./forum/repo/www/modules/contrib/smtp/includes/smtp.phpmailer.inc:1614:    while ( list(, $line) = each($lines) ) {
./forum/repo/www/themes/borg/template.php:515:  // Assigning the array to $flat resets the array pointer for use with each().
./forum/repo/www/themes/borg/template.php:519:    list($key, $curr) = each($flat);
./forum/repo/www/themes/borg/template.php:537:  // Assigning the array to $flat resets the array pointer for use with each().
./forum/repo/www/themes/borg/template.php:539:    list($key, $curr) = each($flat);
./dcu/repo/www/includes/bootstrap.inc:3788:    while (list($key, $callback) = each($callbacks)) {
./dcu/repo/www/includes/install.inc:782:    while (list($module) = each($module_list)) {
./dcu/repo/www/includes/menu.inc:579:          list($function, $args) = each($function);
./dcu/repo/www/includes/menu.inc:2405:      list($key, $curr) = each($tree);
./dcu/repo/www/includes/menu.inc:2435:      list($key, $curr) = each($tree);
./dcu/repo/www/includes/module.inc:407:    while (list($module) = each($module_list)) {
./dcu/repo/www/includes/module.inc:543:    while (list($module) = each($module_list)) {
./dcu/repo/www/modules/locale/locale.test:3192:        while ($equal && list($id) = each($negotiation)) {
./dcu/repo/www/modules/locale/locale.test:3193:          list(, $info_id) = each($info['fixed']);
./dcu/repo/www/modules/book/book.module:771:  // Assigning the array to $flat resets the array pointer for use with each).
./dcu/repo/www/modules/book/book.module:775:    list($key, $curr) = each($flat);
./dcu/repo/www/modules/book/book.module:809:  // Assigning the array to $flat resets the array pointer for use with each).
./dcu/repo/www/modules/book/book.module:811:    list($key, $curr) = each($flat);
./api/backdrop-code-to-index/core/misc/states.js:392:        // Break the each() loop if this is checked.
./api/repo/www/core/misc/states.js:392:        // Break the each() loop if this is checked.
./api/repo/www/modules/contrib/diff/DiffEngine.php:315:        while (list ($junk, $y) = each($matches)) {
./api/repo/www/modules/contrib/diff/DiffEngine.php:323:        while (list ($junk, $y) = each($matches)) {
./api/repo/www/modules/contrib/smtp/includes/smtp.phpmailer.inc:1614:    while ( list(, $line) = each($lines) ) {
./api/repo/www/themes/borg/template.php:515:  // Assigning the array to $flat resets the array pointer for use with each).
./api/repo/www/themes/borg/template.php:519:    list($key, $curr) = each($flat);
./api/repo/www/themes/borg/template.php:537:  // Assigning the array to $flat resets the array pointer for use with each).
./api/repo/www/themes/borg/template.php:539:    list($key, $curr) = each($flat);
./events/repo/www/core/misc/states.js:392:        // Break the each() loop if this is checked.
./events/repo/www/modules/contrib/smtp/includes/smtp.phpmailer.inc:1614:    while ( list(, $line) = each($lines) ) {

It looks like we need to make small changes to the borg theme or update it and update the smtp module.

@jenlampton
Copy link
Member

jenlampton commented Dec 2, 2022 via email

@larsdesigns
Copy link
Contributor Author

@jenlampton, I enabled php 8.1 for a few more projects and updated the check list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants