Jump to content

[SOLVED] Problems on existing site when going from php version 8.0 to 8.1 - getting 404 pages for one template


Violet
 Share

Recommended Posts

I originally set up my ProcessWire site under php 7.4 and then moved to php 8.0 and then to php 8.1 at my web host. However, one set of pages with a particular template refuses to display under php 8.1, instead giving a 404 page not found. It's the standard 404 that I get if the page does not exist. But the template file does exist! And the pages are published! I can work around the problem by taking the php version back down to 8.0 (7.4 also works). But if I bring it back up to 8.1, those pages are not able to be displayed. Does anyone have any suggestions of what I should first start looking at to troubleshoot this issue?

What I have tried so far: I tried to duplicate the template under another name (and yes it did produce a template file in my templates folder with the new name as expected) and I switched one of the problem pages over to the newly duplicated template, but the 404 still persisted under php 8.1.

I have another template that is very similar to the one whose pages won't display, but the similar one works just fine in all php versions. I can't understand why one template would work but a similar one gives a 404 (in php 8.1). They all work fine in php 8.0 and 7.4

I'm not too concerned for the short term as my site works fine with php 8.0, but I'd like to do something about it because I do eventually want my site to work with php 8.1. I realize this is a pretty large/open question, but I would love it if anyone can give me any ideas of where I could start looking to fix this. I would love to be pointed in the right direction.

Edited by Violet
update title to mark it as solved
Link to comment
Share on other sites

  • Violet changed the title to Problems on existing site when going from php version 8.0 to 8.1 - getting 404 pages for one template

@Violet the only thing which could help here is to check the logs as php-8.1 contain new features and incompatible changes. You can check the logs from the admin side in ProcessWire to see if something weird happen, and/or the PHP log of your hosting provider.

 

  • Like 1
Link to comment
Share on other sites

Wow thank you! Everyone helped a lot. This was great advice. Thanks to all of you, the problem is now solved. I was checking each of the things that all of you said, and this was very valuable because in some cases I uncovered some errors or problems that were unrelated to this issue but that needed to be fixed, so I fixed those as I went. So checking php logs, admin panel logs, and using debug = true in the config file turned out to be extremely helpful things to do. My site is simple, with only 1 extra module installed (the PW updating system), and no libraries or other code. So there were a limited number of places where the problem had to be, and I went carefully through the list of suggestions that all of you gave.

The solution

In the end, it was @pwiredthat came up with the correct idea - my template had an include for a non-existent file! I didn't notice it before and I had no idea it was non-existent, but when I looked carefully in each line for includes, sure enough there was no file of that name. Thank you pwired!

And thank you also @Gideon Soand @flydev - your suggestions helped me identify other errors or problems with my site that I have now fixed. Thank you both!

I was a bit surprised that in php 8.1 the include resulted in a 404 not found page, yet in php 8.0 the page was displayed properly (the bad include was ignored). The include was a little way down the rendering of the page, so I expected instead of 404 I would have gotten the top of my site rendering at least (everything above the include, such as the top menu etc). But I don't know much about the different versions of php so maybe 8.1 has a different way of dealing with this. Certainly I should have never written code with an include to a non-existent file! 😳 It was not at all intentional, I removed the file of the include at some point but forgot to delete all references to it in the template file.

I will update the title to mark this problem as solved. Thanks again everyone! I couldn't have done it without you, I didn't even know where to start.

  • Like 4
Link to comment
Share on other sites

  • Violet changed the title to [SOLVED] Problems on existing site when going from php version 8.0 to 8.1 - getting 404 pages for one template

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...