wordpress排错记录

正在执行例行维护,请一分钟后回来

卡死在这个界面时用ssh登录服务器,把WordPress根目录下的 .maintenance文件删除即可。

#进入wordpress根目录
#cd wordpress
#删除文件
rm -rf .maintenance

此站点遇到了致命错误

这个原因有很多,但需要了解具体错误原因才行。故需要开启Debug模式。

编辑WordPress根目录下的wp-config.php文件

/**将以下代码中的false改为true  */
define( 'WP_DEBUG', false);
/**修改后结果如下——即开启Debug模式 */
define( 'WP_DEBUG', true);
/**之后添加以下代码 */
/**开启Debug日志,*/ 
define( 'WP_DEBUG_LOG', true);
/**显示错误信息和警告信息 */
define( 'WP_DEBUG_DISPLAY', true);

之后再遇到“此站点遇到了致命错误”时就会显示错误代码了。

结果如图

调试完成后记把wp-config.php改回来。

#关闭debug模式
define( 'WP_DEBUG', false);
#删除添加的两行代码
define( 'WP_DEBUG_LOG', true);
define( 'WP_DEBUG_DISPLAY', true);
#删除新产生的日志文件/wp-content/debug.log

无法打开wordpress仪表板

一般都是插件冲突、主题冲突。需要关闭所有插件,和主题。

打开wordpress的根目录中的wp-content目录

把themes(主题的存放目录)和plugins(插件的存放目录)随便改个名字就能停止插件和主题的使用。此时进入站点主页会提示错误

需要用用url进入仪表板

#ssh操作如下
#cd wordpress根目录
cd wp-content
#把themes目录重命名为themes_backup
mv themes themes_backup
#之后用域名进入wordpress管理界面进行冲突排错
域名/wp-admin

wordpress忘记管理员密码

wordpress账号、密码都在数据库中记录,只需修改数据库即可。

以mysql数据库为例。用phpmyadmin登录数据库,打开wordpress的数据库,选中xx_user表,点击编辑

此界面可更改用户名、密码、邮箱、网址。。。

输入修改后的密码,同时函数字段选择MD5,本例中密码修改为12345

之后拉到界面最下方点击执行,点哪个都行。


wordpress域名过期无法打开网站

解决方法同上,数据库中修改网址即可。

本次用sql语言进行操作:

ssh连接服务器,登录mysql

#以root用户登录mysql
mysql -u root -p

#输入root用户密码
Enter password:

#进入mysql界面
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2839
Server version: 8.4.4 MySQL Community Server - GPL

Copyright (c) 2000, 2025, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

#显示所有数据库
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| phpmyadmin         |
| sys                |
| wopp               |
| wordpress          |
+--------------------+
7 rows in set (0.00 sec)

#选择wordpress的数据库
mysql> use wordpress;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql>

#查看当前数据库
mysql> show tables;
+----------------------------+
| Tables_in_wordpress        |
+----------------------------+
| ap_actionscheduler_actions |
| ap_actionscheduler_claims  |
| ap_actionscheduler_groups  |
| ap_actionscheduler_logs    |
| ap_aioseo_cache            |
| ap_aioseo_notifications    |
| ap_aioseo_posts            |
| ap_commentmeta             |
| ap_comments                |
| ap_e_events                |
| ap_links                   |
| ap_options                 |
| ap_postmeta                |
| ap_posts                   |
| ap_sakura                  |
| ap_term_relationships      |
| ap_term_taxonomy           |
| ap_termmeta                |
| ap_terms                   |
| ap_usermeta                |
| ap_users                   |
| ap_wfauditevents           |
| ap_wfblockediplog          |
| ap_wfblocks7               |
| ap_wfconfig                |
| ap_wfcrawlers              |
| ap_wffilechanges           |
| ap_wffilemods              |
| ap_wfhits                  |
| ap_wfhoover                |
| ap_wfissues                |
| ap_wfknownfilelist         |
| ap_wflivetraffichuman      |
| ap_wflocs                  |
| ap_wflogins                |
| ap_wfls_2fa_secrets        |
| ap_wfls_role_counts        |
| ap_wfls_settings           |
| ap_wfnotifications         |
| ap_wfpendingissues         |
| ap_wfreversecache          |
| ap_wfsecurityevents        |
| ap_wfsnipcache             |
| ap_wfstatus                |
| ap_wftrafficrates          |
| ap_wfwaffailures           |
+----------------------------+
46 rows in set (0.01 sec)
#查询ap_users表
mysql> SELECT * FROM ap_users ;
#修改user_url键值
mysql> UPDATE `ap_users` SET `user_url` = 'https://111.com' WHERE `ap_users`.`ID` = 1;
Query OK, 1 row affected (0.01 sec)
Rows matched: 1  Changed: 1  Warnings: 0
mysql>

#修改完成
mysql> SELECT user_url FROM ap_users ;
+-----------------+
| user_url        |
+-----------------+
| https://111.com |
+-----------------+
1 row in set (0.00 sec)

#退出mysql
mysql> exit
Bye
root@ubuntu:~#


修改完成


更换域名后图片无法显示

更换域名后,上传图片的地址还是老域名,有时会造成图片无法显示。可通过后台登录mysql进行批量替换。

以mysql的root用户或mysql中运行wordpress数据库的用户执行以下代码即可。

#old_domain.com是老域名。
#new_domain.com是新域名。
#数据库前缀“wp_”更换为你自己的数据库前缀。
UPDATE wp_options SET option_value = replace(option_value, 'old_domain.com', 'new_domain.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET post_content = replace(post_content, 'old_domain.com', 'new_domain.com');
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'old_domain.com', 'new_domain.com');
UPDATE wp_comments SET comment_content = replace(comment_content , 'old_domain.com', 'new_domain.com');

或者phpmyadmin中执行sql代码。

暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇