简体   繁体   English

在 Wordpress 自定义主题上更新到 PHP 8 时出错

[英]Error while updating to PHP 8 on Wordpress Custom Theme

I'm doing a required update to PHP 8 on the WordPress custom theme.我正在 WordPress 自定义主题上对 PHP 8 进行必要的更新。

The suggestion from WPEngine is: to change the theme back to the default one, disable all plugins, update to PHP 8, then switch back to the custom theme. WPEngine的建议是:将主题改回默认主题,禁用所有插件,更新到PHP 8,然后切换回自定义主题。

I tried the same steps but the result was a blank page (sometimes the page below), and the Console tab showed "Failed to load resource: the server responded with a status of 500 ()"我尝试了相同的步骤但结果是一个空白页面(有时是下面的页面),并且控制台选项卡显示“无法加载资源:服务器响应状态为 500 ()” 在此处输入图像描述

在此处输入图像描述

Does anyone have the experience to resolve this?有没有人有解决这个问题的经验? Any suggestions would be appreciated.任何建议,将不胜感激。

Update : A few of error logs更新:一些错误日志

PHP Warning: Constant WP_POST_REVISIONS already defined in /nas/content/live/recession/wp-config.php on line 113 PHP 警告:常量 WP_POST_REVISIONS 已在第 113 行的 /nas/content/live/recession/wp-config.php 中定义

PHP Fatal error: Uncaught Error: Call to undefined function pll_register_string() in /nas/content/live/recession/wp-content/themes/recession/functions.php:91 PHP 致命错误:未捕获错误:调用未定义的 function pll_register_string() in /nas/content/live/recession/wp-content/themes/recession/functions.php:91

#10 /nas/content/live/recession/index.php(17): require('/nas/content/li...') #10 /nas/content/live/recession/index.php(17): require('/nas/content/li...')

auditor:event=wp_login {"user_id":11,"blog_id":1,"event":"wp_login","current_user_id":0,"remote_addr":"90.13.800.12"} auditor:event=wp_login {"user_id":11,"blog_id":1,"event":"wp_login","current_user_id":0,"remote_addr":"90.13.800.12"}

Should I ignore errors from live ?我应该忽略live中的错误吗? I believe it's the error while I attempted to preview the site.我相信这是我尝试预览网站时的错误。

A few notes for some newbies (like myself) while updating the custom theme to PHP 8.0:在将自定义主题更新为 PHP 8.0 时,一些新手(比如我自己)的一些注意事项:

  • If the custom theme breaks the whole webpage, you can check the Error logs tab (in WPEngine for example) and search for errors that start with PHP Fatal Error , which are most likely the causes that break your website.如果自定义主题破坏了整个网页,您可以检查Error logs选项卡(例如在 WPEngine 中)并搜索以PHP Fatal Error开头的错误,这很可能是破坏您的网站的原因。

  • For instance, in my case, there's this error Uncaught TypeError: Unsupported operand types: string + string , which triggered the Fatal error message (It's because the previous dev has used string + number ).例如,在我的情况下,有这个错误Uncaught TypeError: Unsupported operand types: string + string ,它触发了致命错误消息(这是因为以前的开发人员使用了string + number )。 All I need to do was to change it to $var1. (string)$var2我需要做的就是将其更改为$var1. (string)$var2 $var1. (string)$var2 and it pretty much solved the issue. $var1. (string)$var2它几乎解决了这个问题。

  • After fixing all the Fatal Error , the website was back online.修复所有Fatal Error后,该网站重新上线。

The error in the image you sent indicated that something is messed up with the theme, usually "Fatal error".您发送的图像中的错误表明主题有问题,通常是“致命错误”。 Maybe you can check which lines that caused this error in WPEngine perhaps?也许您可以在WPEngine中检查导致此错误的行?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM