IIS手动搭建WordPress5.7

2024-08-15 08:34:56 浏览数 (1)

步骤:

1、创建mysql用户wpuser

CREATE USER 'wpuser'@'localhost' IDENTIFIED BY '密码';

2、创建WordPress数据库wordpres53

create database wordpress53;

3、加权限

grant all privileges on wordpress53.* to 'wpuser'@'localhost';

4、修改源码C:wordpress-5.3.8-zh_CNwordpresswp-config-sample.php

/** The name of the database for WordPress */

define( 'DB_NAME', 'wordpress53' );

/** MySQL database username */

define( 'DB_USER', 'wpuser' );

/** MySQL database password */

define( 'DB_PASSWORD', '密码' );

/** MySQL hostname */

define( 'DB_HOST', 'localhost:3306' );

修改完后,重命名为wp-config.php

5、添加站点

WordPress发行记录:https://cn.wordpress.org/download/releases/

Q2进行了2次整体更新,最新版5.7.2是6月15日更新的

手动搭建WordPress5.3~5.6参考腾讯云官网文档是没问题的:https://cloud.tencent.com/document/product/213/39540

需要注意下,安装WordPress5.3~5.6时,如果报错WordPress database error Table 'wordpress.wp_options' doesn't exist for query INSERT INTO `wp_options` (`option_name`, `option_value`, `autoload`) VALUES ('nonce_key'……

需要对网站目录,给IIS_IUSRS用户添加写权限

但对WordPress5.7.*,添加IIS_IUSRS 用户的写权限也没用,同样的文档,为何对5.3.*~5.6.*可以,对WordPress5.7.*却不行?

看到WordPress官网这个说明挺激动的,以为发现WordPress新版兼容性问题了(bug)

后来耗费大量时间研究,发现PHP版本、MySQL或MariaDB版本都符合,是php.ini的问题,正好WordPress5.7.2对php.ini的配置项多一些,腾讯云官网文档提的这2点不够

https://downloads.mysql.com/archives/get/p/25/file/mysql-installer-community-5.6.51.0.msi

https://downloads.mysql.com/archives/get/p/25/file/mysql-installer-community-5.7.33.0.msi

https://downloads.mysql.com/archives/get/p/25/file/mysql-installer-community-8.0.24.0.msi

https://windows.php.net/downloads/releases/archives/php-5.6.40-nts-Win32-VC11-x64.zip

https://windows.php.net/downloads/releases/archives/php-7.3.27-nts-Win32-VC15-x64.zip

https://windows.php.net/downloads/releases/archives/php-7.4.19-nts-Win32-vc15-x64.zip

https://windows.php.net/downloads/releases/archives/php-8.0.6-nts-Win32-vs16-x64.zip

https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-10.2.38/winx64-packages/mariadb-10.2.38-winx64.msi

https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-10.3.29/winx64-packages/mariadb-10.3.29-winx64.msi

https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-10.4.19/winx64-packages/mariadb-10.4.19-winx64.msi

https://mirrors.tuna.tsinghua.edu.cn/mariadb/mariadb-10.5.10/winx64-packages/mariadb-10.5.10-winx64.msi

这里强烈推荐mariadb,轻便且安装超级简单,比笨重的mysql-installer-community方便很多

IIS PHP环境配置,最牛逼的方案就是phpmanager,目前最新版是1.5,链接:https://www.iis.net/downloads/community/2018/05/php-manager-150-for-iis-10

如何安装IIS,powershell一句话搞定:https://cloud.tencent.com/developer/article/1557571

如何配置IIS-FTP:https://cloud.tencent.com/developer/article/1834773

安装好IIS后在添加的站点右边找到PHP Manager

VC库推荐:https://github.com/abbodi1406/vcredist/releases

注意事项:

mysql -uroot -p密码 -P3306 (安装MariaDB的时候如果把默认3306改成别的端口,即便后来自己停了服务,把my.ini里的port改成3306又重新启动了服务查看3306监听正常,用“mysql -uroot -p密码” 登录报错的话,需要加-P3306显性指定端口就不报错了)

0 人点赞