Fix unable to run update.php on Drupal 8

Are you get­ting an Page not found error when attempt­ing to run update.php?

Then I assume your sev­er is run­ning nginx as the web server. 

To fix update the loca­tion direc­tive for PHP files location ~ \.php$ { with the following

location ~ '\.php$|^/update.php' {
        fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
        include fastcgi_params;
        fastcgi_param HTTP_PROXY "";
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param QUERY_STRING $query_string;
        fastcgi_intercept_errors on;
        fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
    }

If you’re serv­er is on PHP 7.0 or 5.6, then replace the last line, respec­tive­ly. fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; fastcgi_pass unix:/var/run/php/php5-fpm.sock;

Before restart­ing nginx, dou­ble-check the updat­ed con­fig­u­ra­tion is good by running:
sudo nginx -t

If you don’t get any errors then restart the nginx service.
sudo nginx -s reload

Alex Aguilar, Partner, Software Engineer

Alex Aguilar

Partner, Software Engineer