LAMP搭建
一、安装
yum install httpd php php-mysql -y
wget https://repo.mysql.com//mysql80-community-release-el7-3.noarch.rpm
rpm -ivh mysql80-community-release-el7-3.noarch.rpm #mysql yum源,可修改版本
yum install mysql -y
二、修改文件
vi /etc/httpd/conf/httpd.conf
在“DirectoryIndex index.html”后面添加“index.php”
在“AddType application/x-gzip .gz .tgz”后面添加一行“AddType application/x-httpd-php .ph”
systemctl start httpd
三、mysql 设置
grep "password" /var/log/mysqld.log
mysql -uroot -p
alter user 'root'@'localhost' identified by '复杂';
set global validate_password_policy=0;
set global validate_password_length=1;
vi /etc/my.cnf
在[mysqld]前面添加:
[client]
default-character-set=utf8
在文件末尾添加:
character-set-server=utf8
collation-server=utf8_general_ci
systemctl start mysqld
四、测试
vi /var/www/html/index.php
<?php phpinfo(); ?>
http://192.168.70.128/index.php
附:
php常用扩展包:
php-gd php-xml php-process php-mbstring php-bcmath
互相ping:
公用网络:“文件和打印共享(回显请求 – ICMPv4-In)”规则,设置为允许。虚机ping主机
https://blog.csdn.net/hskw444273663/article/details/81301470
防火墙:
firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --reload