WordPress搭建笔记|WordPress搭建笔记 遇到的错误笔记

安装时没有权限写入 wp-config.php

  • 设置apache用户(或者www用户)对WordPress文件夹的写权限(chown -R apache wordpress/)
无法建立目录wp-content/uploads/2015/12。有没有上级目录的写权限?
  • 修改wp-content目录的写权限,方法见上面一条(目录在WordPress站点根目录下),网上也有很多资料说在home目录下,反正我的不是;也有的说修改数据库options中的upload键值,反正我的是没用!!!
安装插件需要输入fpt用户名和密码
  • 查看运行WWW或者Apache的用户,我是直接用vi /etc/passwd 看的 ,比如:用户名为apache或者www,然后chown -R apache wordpress (wordpress是WordPress站点的根目录)
注册邮箱验证: 安装WP Mail SMTP插件
然后设置邮箱服务器,比如使用qq邮箱的:
点击设置->账户->POP3/IMAP/SMIP/Exchange/CardDAV/CalDAV服务,开启服务
图1
图2
QQ邮箱帮助中心
使用AMH面板时无法安装插件 Problem with the SSL CA cert (path? access rights?)
  • AMH面板下载AMCHroot插件,设置中对网站运行环境模式选择 兼容模式
邮箱:您的密码重设链接无效,请在下方请求新链接。 是因为系统发邮箱是多了<>这两个符号,在wp-login.php中327行上下
  • // $message .= '<' . network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . ">\r\n";
    $message .= "". network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') ."\r\n";
  • 还有注册的时候用的:wp-icludes/pluggable.php中1741行左右
    // $message .= '<' . network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user->user_login), 'login') . ">\r\n\r\n";
    $message .= '' . network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user->user_login), 'login') . "";
更改固定链接后找不到页面
  1. 方法一:在固定连接前加/index.php即可,比如/index.php/archives/%post_id%,以后每个页面的地址都会有一个index.php
  2. 方法二:或者修改服务器rewrite规则(推荐),页面不需要添加Index.pn,更美观
    Nginx 解决方案:
    在 /etc/nginx/config.d/mysit.conf文件的 loction \ {} 中添加
if (-f $request_filename/index.html){ rewrite (.*) $1/index.html break; }if (-f $request_filename/index.php){ rewrite (.*) $1/index.php; }if (!-f $request_filename){ rewrite (.*) /index.php; }

Apache解决方案:
etc/httpd/conf/httpd.config 文件
原因一:Apache中的rewrite模块没有开启,去除这一行前面的#号就可以了
LoadModule rewrite_module modules/mod_rewrite.so

原因二:AllowOverride Not Enabled;服务器可能没打开AllowOverride。如果httpd.config的AllowOverride设置的是None,那.htaccess将被忽略。找到以下2处位置并修改:
Options FollowSymLinks AllowOverride All # … other directives… AllowOverride All

修改完成后,要重启Apache才能生效。
service httpd restart

AMH解决
进入amh的rewrite规则文件(位置在AMH控制面板虚拟主机那里看)
vi /usr/local/nginx/conf/rewrite/amh.conf

然后添加代码
if (-f $request_filename/index.html){ rewrite (.*) $1/index.html break; }if (-f $request_filename/index.php){ rewrite (.*) $1/index.php; }if (!-f $request_filename){ rewrite (.*) /index.php; }

保存退出
重启虚拟主机
amh host stop amh host start

自动备份插件(BackWPup) 备份时报错
[INFO] BackWPup 3.3; A project of Inpsyde GmbH [INFO] Log Level: Normal (translated) [INFO] BackWPup job: Neucrack_BackUp_job [INFO] Logfile is: backwpup_log_dc1ef5_2016-03-26_16-41-56.html [INFO] Backup file is: backwpup_dc1ef5_2016-03-26_16-41-56.zip [26-Mar-2016 16:41:56] 1. Try to backup database … [26-Mar-2016 16:41:56]ERROR: No MySQLi extension found. Please install it. [26-Mar-2016 16:41:56] 2. Try to backup database … [26-Mar-2016 16:41:56]ERROR: No MySQLi extension found. Please install it. [26-Mar-2016 16:41:56] 3. Try to backup database … [26-Mar-2016 16:41:56]ERROR: No MySQLi extension found. Please install it. [26-Mar-2016 16:41:56]ERROR: Step aborted: too many attempts! [26-Mar-2016 16:41:56] 1. Trying to make a list of folders to back up … [26-Mar-2016 16:41:56] Added "wp-config.php" to backup file list [26-Mar-2016 16:41:56] 232 folders to backup. [26-Mar-2016 16:41:56] 1. Trying to create a WordPress export to XML file … [26-Mar-2016 16:41:56] Check WP Export file … [26-Mar-2016 16:41:56] WP Export file is a valid WXR file. [26-Mar-2016 16:41:56] Added XML export "Neucrack.wordpress.2016-03-26.xml" with 122.89 kB to backup file list. [26-Mar-2016 16:41:56] 1. Trying to generate a file with installed plugin names … [26-Mar-2016 16:41:56] Added plugin list file "Neucrack.pluginlist.2016-03-26.txt" with 1.04 kB to backup file list. [26-Mar-2016 16:41:56] 1. Trying to generate a manifest file … [26-Mar-2016 16:41:56] Added manifest.json file with 4.18 kB to backup file list. [26-Mar-2016 16:41:56] 1. Trying to create backup archive … [26-Mar-2016 16:41:56] Compressing files as ZipArchive. Please be patient, this may take a moment. [26-Mar-2016 16:42:02] Backup archive created. [26-Mar-2016 16:42:02] Archive size is 24.47 MB. [26-Mar-2016 16:42:02] 2316 Files with 50.55 MB in Archive. [26-Mar-2016 16:42:20] 1. Try to send backup with email … [26-Mar-2016 16:42:20] Sending email to 1208077207@qq.com… [26-Mar-2016 16:47:14] Email sent. [26-Mar-2016 16:47:14] 1. Trying to check database … [26-Mar-2016 16:47:14] Database check done! [26-Mar-2016 16:47:14]ERROR: Job has ended with errors in 318 seconds. You must resolve the errors for correct execution.

解决:
主要是因为插件使用了php的mysqli扩展对数据库进行备份,但是php没有装此扩展,需要手动安装。
安装则需要一份类似Windows中的dll文件,linux中是.so文件,这个文件要编译php源码获得,步骤如下:
下载php响应版本的源码
使用php --version 查看版本,
然后下载相同版本的源码并解压
用whereis php查看php安装位置
进入解压的文件夹下/ext/扩展名 目录下(扩展名就是想装得扩展的名字)
【WordPress搭建笔记|WordPress搭建笔记 遇到的错误笔记】执行/usr/local/php/bin/phpize (phpize是个可执行文件)
发现在ext/扩展名 目录下多了一些configure文件
如果没错,继续
./configure --prefix=/usr/local/mysqli --with-php-config=/usr/local/php/bin/php-config --with-mysqli=/usr/local/mysql/bin/mysql_config
这里的目录仍然是你已安装的php所在目录。
如果没有报错,则make,再make install ,然后它会提示你Installing shared extensions: 目录名
看/etc/php.ini中有没有,extension_dir:
有就应该是上一步的目录名,如果不是,改成那个目录名
在最后添加一行:extension=mysqli.so
重启php服务器
[INFO] BackWPup 3.3; A project of Inpsyde GmbH [INFO] Log Level: Normal (translated) [INFO] BackWPup job: Neucrack_BackUp_job [INFO] Logfile is: backwpup_log_dc1ef5_2016-03-26_20-23-21.html [INFO] Backup file is: backwpup_dc1ef5_2016-03-26_20-23-21.zip [26-Mar-2016 20:23:21] 1. Try to backup database … [26-Mar-2016 20:23:22] Connected to database wordpress_neucrack on localhost [26-Mar-2016 20:23:22] Added database dump "wordpress_neucrack.sql" with 808.93 kB to backup file list [26-Mar-2016 20:23:22] Database backup done! [26-Mar-2016 20:23:22] 1. Trying to make a list of folders to back up … [26-Mar-2016 20:23:22] Added "wp-config.php" to backup file list [26-Mar-2016 20:23:22] 232 folders to backup. [26-Mar-2016 20:23:22] 1. Trying to create a WordPress export to XML file … [26-Mar-2016 20:23:22] Check WP Export file … [26-Mar-2016 20:23:22] WP Export file is a valid WXR file. [26-Mar-2016 20:23:22] Added XML export "Neucrack.wordpress.2016-03-26.xml" with 123.00 kB to backup file list. [26-Mar-2016 20:23:22] 1. Trying to generate a file with installed plugin names … [26-Mar-2016 20:23:22] Added plugin list file "Neucrack.pluginlist.2016-03-26.txt" with 1.04 kB to backup file list. [26-Mar-2016 20:23:22] 1. Trying to generate a manifest file … [26-Mar-2016 20:23:22] Added manifest.json file with 4.17 kB to backup file list. [26-Mar-2016 20:23:22] 1. Trying to create backup archive … [26-Mar-2016 20:23:22] Compressing files as ZipArchive. Please be patient, this may take a moment. [26-Mar-2016 20:23:28] Backup archive created. [26-Mar-2016 20:23:28] Archive size is 24.64 MB. [26-Mar-2016 20:23:28] 2317 Files with 51.36 MB in Archive. [26-Mar-2016 20:23:34] 1. Try to send backup with email … [26-Mar-2016 20:23:34] Sending email to 1208077207@qq.com… [26-Mar-2016 20:26:35] Email sent. [26-Mar-2016 20:26:36] 1. Trying to check database … [26-Mar-2016 20:26:36] Database check done! [26-Mar-2016 20:26:36] Job done in 195 seconds.

    推荐阅读