编译安装php
# wget http://hk1.php.net/get/php-7.0.19.tar.gz/from/this/mirror //下载php镜像资源
# ll //查看当前目录文件
# file mirror //查看文件属性,确认是否为.tar.gz文件,而不是HTML document text
# tar -zxvf php-7.0.19.tar.gz //解压php镜像
# cd php-7.0.19/
[root@localhost php-7.0.19]# ./configure --prefix=/usr/local/php7 --enable-fpm //将php安装在/usr/local文件目录下,新建php7文件夹,并安装FPM
+--------------------------------------------------------------------+
| License: |
| This software is subject to the PHP License, available in this |
| distribution in the file LICENSE. By continuing this installation |
| process, you are bound by the terms of this license agreement. |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point. |
+--------------------------------------------------------------------+
Thank you for using PHP.
出现以上表示config配置成功
# make //编译php,编译时间较常
+--------------------------------------------------------------------+
Build complete.
Don't forget to run 'make test'.
+--------------------------------------------------------------------+
出现以上表示编译完成
# make install //编译安装
# vim test2.php
# /usr/local/php7/bin/php test2.php //编辑测试,打印输出phpinfo()信息
Configuration
Core
PHP Version => 7.0.19
显示php版本信息,php编译安装成功
mysql> select user,password,host from user;
+——–+——————————————-+———————–+
| user | password | host |
+——–+——————————————-+———————–+
| root | *E94BB31DEB47B4D1C4455CC4E6C2A2068B11FEAF | localhost |
| root | | localhost.localdomain |
| root | | 127.0.0.1 |
| root | | ::1 |
| | | localhost |
| | | localhost.localdomain |
| root | *E94BB31DEB47B4D1C4455CC4E6C2A2068B11FEAF | % |
| yanyan | *40973C3FEAC1C9AC2AF8A126DA9632D9F4263B5C | ’172.17.130.224’ |
+——–+——————————————-+———————–+
8 rows in set (0.00 sec)
MySQL 安装
查看是否已经安装了mysql
[root@localhost ~]# rpm -qa|grep mysql
mysql-community-libs-5.6.36-2.el7.x86_64
mysql-community-devel-5.6.36-2.el7.x86_64
mysql-community-release-el7-5.noarch
mysql-community-common-5.6.36-2.el7.x86_64
php-mysql-5.4.16-42.el7.x86_64
mysql-community-server-5.6.36-2.el7.x86_64
mysql-community-client-5.6.36-2.el7.x86_64
进入mysql
[root@localhost ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.6.36 MySQL Community Server (GPL)
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
具体安装可以参考这篇博客,介绍比较详细。传送门
Apache安装
因为之前已经安装好了Apache,我们查看一下它的版本和状态。
[root@localhost ~]# apachectl -v
[root@localhost ~]# whereis httpd
httpd: /usr/sbin/httpd /usr/lib64/httpd /etc/httpd /usr/include/httpd /usr/share/httpd /usr/share/man/man8/httpd.8.gz
[root@localhost ~]# rpm -qa|grep httpd
httpd-devel-2.4.6-45.el7.centos.4.x86_64
httpd-tools-2.4.6-45.el7.centos.4.x86_64
httpd-2.4.6-45.el7.centos.4.x86_64
[root@localhost ~]# service httpd status
Redirecting to /bin/systemctl status httpd.service
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since 四 2017-06-08 20:53:55 CST; 4 days ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 16871 ExecReload=/usr/sbin/httpd $OPTIONS -k graceful (code=exited, status=0/SUCCESS)
Main PID: 1016 (httpd)
Status: "Total requests: 0; Current requests/sec: 0; Current traffic: 0 B/sec"
CGroup: /system.slice/httpd.service
├─ 1016 /usr/sbin/httpd -DFOREGROUND
├─16883 /usr/sbin/httpd -DFOREGROUND
├─16884 /usr/sbin/httpd -DFOREGROUND
├─16885 /usr/sbin/httpd -DFOREGROUND
├─16886 /usr/sbin/httpd -DFOREGROUND
└─16887 /usr/sbin/httpd -DFOREGROUND
6月 08 20:53:41 localhost.localdomain systemd[1]: Starting The Apache HTTP S...
6月 08 20:53:55 localhost.localdomain systemd[1]: Started The Apache HTTP Se...
6月 12 03:34:02 localhost.localdomain systemd[1]: Reloaded The Apache HTTP S...
Hint: Some lines were ellipsized, use -l to show in full.
安装参考传送门
注意对防火墙访问80端口
[root@localhost ~]# firewall-cmd --zone=public --add-port=80/tcp --permanent
success
[root@localhost ~]# systemctl restart firewalld.service
完成。