今天下午在Centos上搭了一个PHP+MySQL+Apache环境,简单的写了一下步骤,如下:
1、安装 mysql
yum install mysql
2、安装 mysql-server
yum install mysql-server
3、安装 mysql-devel
yum install mysql-devel
4、启动 mysql服务(特别注意启动的时候命令里面是mysqld,而不是mysql)
service mysqld start
5、显示在监听状态的所有Tcp相关的选项
netstat -alnt

6、安装php
yum install php
7、安装 php-devel
yum install php-devel
8、在/var/www/html下创建一个index.php
cd /var/www/html

在/var/www/html下创建index.php,内容如下:

8、查看Apache是否打开
service httpd status
9、没有打开的话,开启Apache
service httpd start
10、在浏览器中访问127.0.0.1/index.php,成功访问。结果如下:

|