php和wordpress常见错误-插件安装和站点地图和主题编辑

错误1:Uncaught Error: Call to undefined function simplexml_load_string()

2020/04/03 21:48:41 [error] 19198#19198: *16474 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Call to undefined function simplexml_load_string() in /var/www/html/wordpress/wp-content/themes/XIU/options/update.php:72
Stack trace:
#0 /var/www/html/wordpress/wp-content/themes/XIU/options/update.php(4): get_latest_theme_version()
#1 /var/www/html/wordpress/wp-includes/class-wp-hook.php(287): update_notifier_menu()
#2 /var/www/html/wordpress/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters()
#3 /var/www/html/wordpress/wp-includes/plugin.php(478): WP_Hook->do_action()
#4 /var/www/html/wordpress/wp-admin/includes/menu.php(155): do_action()
#5 /var/www/html/wordpress/wp-admin/menu.php(326): require_once('/var/www/html/w...')
#6 /var/www/html/wordpress/wp-admin/admin.php(153): require('/var/www/html/w...')
#7 /var/www/html/wordpress/wp-admin/themes.php(10): require_once('/var/www/html/w...')
#8 {main}
  thrown in /var/www/html/wordpress/wp-content/themes/XIU/options/update.php on line 72" while reading response header from upstream, client: 115.206.245.181, server: www.52xintaidu.com, request: "GET /wp-admin/themes.php?action=activate&stylesheet=arimolite&_wpnonce=e2834bc661 HTTP/2.0", upstream: "fastcgi://unix:/run/php/php7.4-fpm.sock:", host: "www.52xintaidu.com", referrer: "https://www.52xintaidu.com/wp-admin/themes.php"

安装php7.4 xml插件:

sudo apt install -y software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
apt-get install php7.4-xml

2 php7.4 sitemaps 站点地图

站点地图可以安装 Yoast插件。默认就带了站点地图链接。

This page contains the following errors:
error on line 2 at column 6: XML declaration allowed only at the start of the document
Below is a rendering of the page up to the first error

XML 解析错误:XML 或文本声明不在实体的开头
位置:https://www.52xintaidu.com/post-sitemap.xml
行 1,列 2:
 <?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="//www.52xintaidu.com/wp-content/plugins/wordpress-seo/css/main-sitemap.xsl"?>
-^

原因和解决办法:

看站点地图的源码!会发现在第一行的代码前面多了一行空格!

要解决此错误,请继续检查以下1个重要文件:

文件 wp-config.php       //他在网站根目录中找

修改wp-config.php 把第一行去掉

3 WordPress无法编辑主题文件

“在您保存修改前,您需要将此文件设置为手写…”

  • 问题:这是因为权限不够,而且当你修改时最后也没有”更新文件“按钮
  • 解决:通过到服务器修改权限
chmod 777 -R /var/www/html/wordpress/wp-content/
赞 (0) 打赏

评论 0

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏