使用yum安装lamp
- yum install epel-release -y 安装源
- rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm -y
- yum install httpd -y 安装apache
- *yum install php70w -y 安装php7
- yum install php70w-pecl-redis -y yum install php70w-mysql -y 安装redis和mysql扩展
- yum install mariadb-server -y 安装mysql客户端
额外扩展安装
- 搜索
yum search php | grep mbstring
- 安装
yum install php70w-mbstring -y
- 重启apache
systemctl restart httpd
安装环境之后的配置
mariadb 默认密码为空,修改密码
mysql –uroot –p
回车
use mysql
update user set password =password (‘密码’) where user=’root’;
flush privileges;
-
mariadb 设置允许远程连接:
1. 修改表
把user表的host改为%
2. 授权
GRANT ALL PRIVILEGES ON . TO ‘root’@’%’ IDENTIFIED BY ‘123456’ WITH GRANT OPTION;
-
ThinkPHP的Runtime写入问题
1. 可能是系统本身的原因
vim /etc/selinux/config 修改为:
selinux=disabled![]()
2. Runtime文件夹没有写入权限
Chmod 777 –R * 递归更改权限。
-
Apache重写规则
直接编辑 /etc/httpd/conf/httpd.conf
找到Include conf.modules.d/*.conf 把所有的配置文件加载进来
在此行的内容下添加:重写规则
LoadModule rewrite_module modules/mod_rewrite.so
继续找到以下内容:
1.
Options Indexes FollowSymLinks
2. #
3. # AllowOverride controls what directives may be placed in .htaccess files.
4. # It can be “All”, “None”, or any combination of the keywords:
5. # Options FileInfo AuthConfig Limit
6. #
7. AllowOverride None
将此处的AllowOverride None修改为AllowOverride all。