一: 环境搭建

1 ) 安装Apache

#sudo apt-get apache2 -y

#sudo systemctl enable apache2

#sudo systemctl start apache2

2 ) 安装php

#sudo apt-get install php php-fpm  -y

$验证

#sudo php -v

3 ) 安装mysql

#sudo apt-get install mysql-server php-mysql -y

配置mysql

#sudo mysql_secure_installation

(按照提示设置数据库密码)

#sudo mysql -uroot -p

创建数据库

#create database wordpress;

设置数据库用户名和密码

#GRANT ALL PRIVILEGES ON wordpress.* TO ‘root’@’localhost’ IDENTIFIED BY ‘YOURPASSWORD’;

#FLUSH PRIVILEGES;

#exit

二 : 搭建wordpres

下载#sudo wget -c http://wordpress.org/latest.tar.gz

解压#sudo tar -xzvf latest.tar.gz

#cd wordpress

# mv wp-config-sample.php wp-config.php

配置#sudo nano wp-config.php

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', '数据库名');

/** MySQL database username */
define('DB_USER', '数据库用户名');

/** MySQL database password */
define('DB_PASSWORD', '数据库密码');

/** MySQL hostname */
define('DB_HOST', 'localhost');

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');

define('WPLANG', 'zh_CN');

define("FS_METHOD","direct");
define("FS_CHMOD_DIR", 0777);
define("FS_CHMOD_FILE", 0777);

错误1:您的 PHP 似乎没有安装运行 WordPress 所必需的 MySQL 扩展

解决办法:

# vim /etc/php5/fpm/php.ini

; extension=msql.so
extension=msql.so

# service nginx restart

打赏

发表评论