Aegir install: /update.php/selection returns 404/Page not found on nginx, php8.1, Drupal 9.5.9

Created on 24 May 2023, over 1 year ago
Updated 1 February 2024, 11 months ago

Problem/Motivation

I login as admin
I goto update.php
Hit return
the next page is a 404, cannot be found

I then tried adding this to my nginx configuration

### Drupal 9.5.9, php8.1                                                                           
### https://www.drupal.org/project/drupal/issues/2606180#comment-14559523       
### https://www.reinisfischer.com/how-install-drupal-9-nginx-php-fpm-81-mysql-phpmyadmin-ubuntu-2204-linode-guide                   
location ~ ^/update.php{
# fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
 fastcgi_split_path_info ^(.+\.php)(/.+)$;                                                        
 include fastcgi_params;
 include snippets/fastcgi-php.conf;
# fastcgi_index    update.php;                                                                     
# try_files $fastcgi_script_name =404;                                                             
 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;                                
 #fastcgi_param SCRIPT_FILENAME $request_filename;
 fastcgi_intercept_errors on;
 #fastcgi_param QUERY_STRING $query_string;                                                        
 fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
}

I got a database error when I goto /update.php/selection
FastCGI sent in stderr: "PHP message: Drupal\Core\Database\ConnectionNotDefinedException: The specified database connection is not defined: default in /drupal9.5.9/html/core/lib/Drupal/Core/Database/Database.php on line 454 #0 /drupal9.5.9/html/core/lib/Drupal/Core/Database/Database.php(188): Drupal\Core\Database\Database::openConnection('default', 'default')
#1 /drupal9.5.9/vendor/symfony/dependency-injection/ContainerBuilder.php(1130): Drupal\Core\Database\Database::getConnection('default')
#2 /drupal9.5.9/vendor/symfony/dependency-injection/ContainerBuilder.php(618): Symfony\Component\DependencyInjection\ContainerBuilder->createService(Object(Symfony\Component\DependencyInjection\Definition), Array, true, 'database')
#3 /drupal9.5.9/vendor/symfony/d" while reading response header from upstream, client: 68.66.114.206, server: drupal9.5.9, request: "GET /update.php/selection HTTP/2.0", upstream: "fastcgi://unix:/var/run/php/php8.1-fpm.sock:", host: "drupal9.5.9", referrer: "https://drupal9.5.9/update.php"

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ’¬ Support request
Status

Closed: won't fix

Version

3.0

Component
DatabaseΒ  β†’

Last updated about 16 hours ago

  • Maintained by
  • πŸ‡³πŸ‡±Netherlands @daffie
Created by

πŸ‡ΊπŸ‡ΈUnited States SocialNicheGuru

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @SocialNicheGuru
  • πŸ‡¬πŸ‡§United Kingdom longwave UK

    There is no evidence this is a bug in Drupal, so changing to a support request - this seems to be a settings.php problem or an nginx configuration problem.

    PHP message: Drupal\Core\Database\ConnectionNotDefinedException: The specified database connection is not defined: default
    

    This would appear to be the issue, for some reason it can't find your $settings['database']['database'] in settings.php.

    FWIW I use this in nginx config for Drupal, which is the same as the two lines commented out, instead of the two uncommented ones:

    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    
  • Status changed to Postponed: needs info over 1 year ago
  • This issue is developing an official nginx configuration. Anything you need should be there or could take the form of feedback by you on the proposed configuration.

  • πŸ‡ΊπŸ‡ΈUnited States SocialNicheGuru

    I realized that this is an Aegir/Provision/Hostmaster specific issue.

    I did have to add the location block above to /var/aegir/config/includes/nginx_vhost_common.conf

    I had to follow this, https://docs.aegirproject.org/usage/sites/, and add a line to drushrc.php:

    Set $options['provision_db_cloaking'] = FALSE; in the site's drushrc.php and then re-verify the site.

    This has security implications.

    Then i had to set $database['default']['default'] equal to their corresponding databse values from $options in drushrc.php.

    This seems like a lot to just get /update.php to work as now since the next step goes to /update.php/selection

  • Status changed to Active over 1 year ago
  • πŸ‡΅πŸ‡±Poland memtkmcc

    Aegir 3.x actually supports both PHP 8.1/8.2 and latest Drupal 9.x but not in this main/current upstream version but in the BOA fork, so we are working on backporting all accumulated fixes/patches.

  • πŸ‡«πŸ‡·France mitsuko

    Great news !

  • Status changed to Closed: won't fix 11 months ago
  • πŸ‡¬πŸ‡§United Kingdom steven jones

    @SocialNicheGuru tbh I'm not sure using update.php via the web is supposed to be supported in Aegir.

    You should be migrating between platforms to run database updates etc.

  • πŸ‡΅πŸ‡±Poland memtkmcc

    This has been fixed in BOA and we need to commit the fix back. While not recommended, it’s still useful for users trying to fix issues they can’t fix with system nor local Drush.

Production build 0.71.5 2024