PHP 7.4 -> 8.1 Upgrade Fixes
When upgrading a couple of my servers to the latest Ubuntu, I ran into an issue with my php-based websites, including this one, where I was getting a simple yet inscrutible “File not found.” message instead of the php website.
Digging in, I found a few clues initially:
- The latest LTS of ubuntu (only a year old now :-p) had upgraded to PHP 8.1 from PHP 7.4, changing the php-fpm system I use to run these sites in a few ways
- Static pages still loaded fine, so nginx was basically working
- Eventually, by enabling php-fpm access logging and using this helpful answer, I verified that the issue had something to do with nginx no longer correctly passing the url to php-fpm.
Poking around a bit more and diffing the default 7.4 and 8.1 fpm server files, I found that it turns out that php-fpm 8.1 moved a bunch of config settings that make php work easily into snippets/fastcgi-php.conf. By including this file and removing the fastcgi_index and include fastcgi_params directives, I was able to restore order to my hosted sites.
Not exactly how I wanted to spend Friday morning, but onward! Hopefully this helps someone out there some day.