forumone / web-starter

Starting place for developing Drupal, Wordpress and other web applications
http://forumone.github.io/web-starter/
22 stars 11 forks source link

/update.php/selection 404 Not Found #281

Closed johnbburg closed 5 years ago

johnbburg commented 7 years ago

Drupal 8 uses this path to run through the stages of running database updates on a site (seems like they should just use an anchor reference, or a GET parameter, but that's my opinion...). Typically, this would be irrelevant, because the most efficient way to run database updates is to use drush. However, when you are developing update hooks, it is helpful to be able to use a debugger and breakpoints. This is difficult to do with drush because 1, you would need to set an environmental variable to trigger xdebug in a command line context, then also have the drush executable mapped to some file that also exists in your host file system, and accessible to your IDE.

This is a known issue with Drupal 8 and nginx, and there are some solutions already proposed:

Updates to nginx config https://www.drupal.org/node/2606180#comment-11934733 which proposes this:

location ~ ^/update.php {
  fastcgi_split_path_info ^(.+\.php)(/.+)$;

  fastcgi_intercept_errors on;
  fastcgi_pass unix:/php/php5-fpm.sock;
  fastcgi_index update.php;
  include fastcgi_params;
  fastcgi_param SCRIPT_FILENAME /code/$fastcgi_script_name;
  fastcgi_param  SCRIPT_NAME /update.php;
}

Simply use a trailing slash on these paths also works: https://www.drupal.org/node/2353907 This is a simple enugh solution, but I've been fiddling around with this for over half an hour, and it seems like something we can fix and spare future devs some frustration.

Edit: Actually, the trailing slash does not work in web-starter. You still get a 404 page.

johnbburg commented 7 years ago

I had to tweak the snippet to work on web-starter a little:

location ~ ^/update.php {
  fastcgi_split_path_info ^(.+\.php)(/.+)$;
  fastcgi_intercept_errors on;
  fastcgi_pass unix:/var/run/php-fpm.sock;
  fastcgi_index update.php;
  include fastcgi_params;
  fastcgi_param SCRIPT_FILENAME /vagrant/public/$fastcgi_script_name;
  fastcgi_param  SCRIPT_NAME /update.php;
}

One would need to use their project specific web-root here.