linux操作系统lnmp环境安装wordpress(主题无法正常使用)
1.wordpress 下载地址(linux)
- https://cn.wordpress.org/wordpress-4.8.1-zh_CN.tar.gz
- 指定下载的位置&解压(例:/home/wwwroot/www…./)
cd /home/wwwroot/www/
wget https://cn.wordpress.org/wordpress-4.8.1-zh_CN.tar.gz
tar -xf wordpress-4.8.1-zh_CN.tar.gz
2.为整个目录内容设置权限,(根据需要设置,这里设置为777,最高权限)
chmod -R 777 wordpress
3.wordpress相关设置
- 浏览器中打开 192.0.0.0(对应地址)/wordpress/(默认打开index.php)
按照步骤依次设置信息具体注册过程不再详述
4.解决已有主题无法显示问题(只显示一个主题的问题)
修改配置文件php.ini
vim /usr/local/php/etc/php.ini
/scandir
去掉disable_funcions = 后面的”scandir”就可以了
重启lnmp
lnmp restart
5.解决主题无法下载安装问题
-在wp-content 下创建tmp文件夹
cd /home/wwwroot/www/wordpress/wp-content/
mkdir tmp
-配置wp-config.php文件
cd ../
vim wp-config.php
在
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
与
require_once();
之间添加
define('WP_TEMP_DIR', ABSPATH.'wp-content/tmp');
define("FS_METHOD", "direct");
define("FS_CHMOD_DIR", 0777);
define("FS_CHMOD_FILE", 0777);
最终显示
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . '/');
define('WP_TEMP_DIR', ABSPATH.'wp-content/tmp');
define("FS_METHOD", "direct");
define("FS_CHMOD_DIR", 0777);
define("FS_CHMOD_FILE", 0777);
require_once();