Updating from 7.2 breaks site

Hello! I’m a front-end WP developer trying to update PHP on a client’s commercial website. Updating from 7.2 to 7.3 or 7.4 instantly breaks the site (503 Service Unavailable).

Changing to generic themes and disabling all plugins does not make a difference.

In trying to troubleshoot on my own, I hoped to enable error logging so I’d have something to share, but I discovered that there was no php.ini file, and it was not being generated when I applied the updates via Bluehost’s Multi PHP Manager function. So, I created one and added this:

log_errors = on
error_reporting = 32767
error_log = /home1/root name redacted/logs

That generated a file when I tried loading the home page, but the file only had historical error data and nothing useful for this situation.

So, I’m stuck now. Any suggestions?

Did you upgrade your WP also? Some versions of WP will not run on the latest version of PHP without upgrading it also. You talk about PHP updating, but, which version of WP are you using? Most likely PHP is okay, just needs a newer version of WP.
Hope you are doing this on a test server or duplicate so the live site is not down.

Thanks for the reply. Yes, WP is up to date, and yes, it was in a staging environment.

Good. Now, you should clean out your php error logs and then run the site again and review the logs.
In a “staging” environment, you might find the logs on the server, but, they might be under the main folder it.
As an example, in WAMP, it is located in the root folder in a folder called “logs”. They are just text files.
Can be deleted since it is just for testing. Then, the new ones would contain just your live tests from your
site. That way, you can see what is the true errors. Post them and we can help.

The log doesn’t show any kind of fatal errors. It shows:

[24-Jan-2021 20:30:23 UTC] PHP Notice: Undefined variable: class_name in /home1/glsolut1/public_html/wp-content/plugins/all-404-redirect-to-homepage/functions.php on line 32
[24-Jan-2021 20:30:23 UTC] PHP Notice: Undefined variable: class_name in /home1/glsolut1/public_html/wp-content/plugins/all-404-redirect-to-homepage/functions.php on line 44
[24-Jan-2021 20:31:16 UTC] PHP Notice: Undefined index: autoptimize_imgopt_number_field_7 in /home1/glsolut1/public_html/wp-content/plugins/autoptimize/classes/autoptimizeImages.php on line 773

The last error (line 773) is repeated about a hundred times. Doesn’t seem very telling, but I don’t know jack about this stuff.

Well, those ARE your fatal errors. They all say that there are missing data in your system. I will go over them a little, but, not sure if I can fix it for you without knowing more about the entire site.

First two errors are about classes. A class is basically a function, but, it is an OBJECT function, not just a simple list of commands. They both say that the class_name variable is missing on line 32 and 44 of the functions.php file. Therefore, you will need to look at the functions.php file and those two lines to see why that variable is missing. Most likely a previous command above those lines is not creating the variable correctly.

The third error is similar, but, harder to explain. An undefined-index means that you are accessing an array and the array index passed to it does not exist inside array. So a simple array like this:
$colors=(1=>“black”, 2=>“white”,4=>“pink”); would have 3 entries. A numeric index or key and a text value. If you try to echo it like this: echo $color[3]; The index does not exist and it throws an undefined index error. I think that is easy to understand. Now, in your line 773 of the image code which is named autoptimizeimages.php, the code is using autoptimize_imgopt_number_field as an index into the array. You need to look at that line 773 and see where that index is being created. Make sure the spelling of it is correct as it is an oddly named index. Either it is spelled wrong or it is not being created before it is used. Again, we would need to see more of the code to assist you in fixing that error.

At least we now know where the errors are. So, you can review these pages and see what is wrong. I suspect that there might be a code where those three indexes are created that is deprecated. What that means is that you might be using a command that is no longer in your version 7.4.

Also, you might want to reinstall WordPress. I have seen in the past that when you install a newer version of PHP, WP gets messed up and if you reinstall it, it fixes pointers which might be an issue.
I would start by looking where those three indexes are created and attempt to fix them that way first.

I understood your explanation, but was unable to see where the problem was. Reinstalling WP 5.6 didn’t help, so I’m back to square one. At this point, I’m afraid I need to recommend someone with deeper technical know-how to the client. Is there a resource you would recommend? You’ve been very kind and helpful so far.

Well, it sounds like you need to debug the system. To do that, you would need to give a programmer access to your server or at the least a copy of it. But, you can hire programmers here in our hire-a-programmer area. Several programmers here might work for you. Post a request in that section and you can discuss rates with them.

Or at least show us these lines with a few before each and after each so we can see if it is an obvious error. Sometimes it’s just a spelling error… Good luck either way!

Sponsor our Newsletter | Privacy Policy | Terms of Service