通过yum安装配置lamp

1、安装httpd yum install httpd 创建测试文件 cd /var/www/html vim index.PHP 加入以下内容 <html> <head> <title>PHP Page</title> </head> <body> <h1>PHP start</h1>

&lt;?PHP
    PHPinfo();
?&gt;
 &lt;h1&gt;PHP  end&lt;/h1&gt;

</body> </html>

启动httpd服务器 service httpd start 关闭防火墙 service iptables stop 修改httpd配置文件添加认启动文件 vim /etc/httpd/conf/httpd.conf /index 修改完后从新加载一下服务 service httpd reload

2、安装PHP yum install PHP 进入PHP配置文件查看信息 vim /etc/httpd/conf.d/PHP.conf 把hpptd的配置文件中的认头文件删除 vim /etc/httpd/conf/httpd.conf 找到index.PHP,去掉 重启httpd服务 service httpd restart 然后测试一下index.PHP 如果能够解释PHPinfo()函数,说明PHP成功安装。 3、安装MysqL数据库 yum install MysqL MysqL-server 服务器程序:MysqLd 启动服务器程序:service MysqLd start 初次启动服务器会初始化数据库 服务脚本:/etc/rc.d/init.d/MysqLd 配置文件:/etc/my.cnf 数据文件:/var/lib/MysqL数据库用户受权 MysqL> grant all on . to 'root'@'192.168.1.%' identified by '12321'; MysqL> grant all on . to 'root'@'127.0.0.1' identified by '12321'; MysqL> grant all on . to 'root'@'localhost' identified by '12321'; MysqL> flush privileges;

安装PHP连接MysqL模块 yum install PHP-MysqL 测试代码 <?PHP $conn = MysqL_connect('localhost','root','12321'); if ($conn) echo "succ"; else echo "failute"; MysqL_close(); ?> 如果把localhost改成服务器IP或者是127.0.0.1会连接失败。解决办法,把LINUX防火墙关闭

关闭SELINUX

chkconfig --level 12345 iptables off chkconfig --level 12345 ip6tables off service iptables stop service ip6tables stop 查看SELinux状态: 1、/usr/sbin/sestatus -v ##如果SELinux status参数为enabled即为开启状态 SELinux status: enabled 2、getenforce ##也可以用这个命令检查 关闭SELinux: 1、临时关闭(不用重启机器): setenforce 0 ##设置SELinux 成为permissive模式 ##setenforce 1 设置SELinux 成为enforcing模式 2、修改配置文件需要重启机器: 修改/etc/selinux/config 文件 将SELINUX=enforcing改为SELINUX=disabled

相关文章

用的openwrt路由器,家里宽带申请了动态公网ip,为了方便把2...
#!/bin/bashcommand1&command2&wait从Shell脚本并行...
1.先查出MAMP下面集成的PHP版本cd/Applications/MAMP/bin/ph...
1、先输入locale-a,查看一下现在已安装的语言2、若不存在如...
BashPerlTclsyntaxdiff1.进制数表示Languagebinaryoctalhexa...
正常安装了k8s后,使用kubect工具后接的命令不能直接tab补全...