編譯安裝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
完成。