CentOS7.0+ 安装PHP+Apache+MySQL

PHP和Apache的安装跟以前系统差不多,有差别的主要是MySQL的安装。

安装Apache

[root@VM_0_14_centos ~]# yum -y install httpd
[root@VM_0_14_centos ~]# service httpd start
[root@VM_0_14_centos ~]# chkconfig httpd on

安装PHP

[root@VM_0_14_centos ~]# yum -y install php
[root@VM_0_14_centos ~]# yum -y install php-fpm
[root@VM_0_14_centos ~]# service php-fpm start

安装MySQL

[root@VM_0_14_centos ~]# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
[root@VM_0_14_centos ~]# rpm -ivh mysql-community-release-el7-5.noarch.rpm
[root@VM_0_14_centos ~]# yum install mysql-community-server
[root@VM_0_14_centos ~]# Is this ok[y/d/N]:y
过程有点漫长,请耐心等待!

[root@VM_0_14_centos ~]# service mysqld start
[root@VM_0_14_centos ~]# chkconfig mysql on
[root@VM_0_14_centos ~]# yum -y install httpd-manual mod_ssl mod_perl mod_auth_mysql
[root@VM_0_14_centos ~]# yum -y install php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc php-devel
[root@VM_0_14_centos ~]# yum -y install mysql-connector-odbc mysql-devel libdbi-dbd-mysql
[root@VM_0_14_centos ~]# mysql -uroot -p
mysql>show databases;
mysql>use mysql;
mysql>set password for 'root@localhost' = password('your password');
mysql>exit;
[root@VM_0_14_centos ~]# service httpd restart
[root@VM_0_14_centos ~]# service mysqld restart

测试

[root@VM_0_14_centos ~]# cd /var/www/html
[root@VM_0_14_centos ~]# touch index.php
[root@VM_0_14_centos ~]# vi index.php
i
<?php
    phpinfo();
?>
ESC :wq 回车
浏览器地址栏输入localhost/index.php

phpinfo

猜你喜欢

转载自blog.csdn.net/phpzhi/article/details/81839726
今日推荐