安裝PHP-7.2
阿新 • • 發佈:2019-02-18
前言
PHP只是一個平臺解析環境,用於解析執行PHP語言程式碼編寫出來的PHP指令碼程式。
系統環境
CentOS Linux release 7.3.1611
開始安裝
一、基礎網路配置
配置一個靜態IP,關閉防火牆、SeLinux
# systemctl stop firewalld
# setenforce 0
二、安裝YUM源,由Remi提供
# rpm -i https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
# rpm -i http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
三、安裝PHP72
# yum -y install php72
四、我們編寫一個簡單的PHP頁面,測試執行
# vi test.php
<?php
echo "hello world!";
?>
# php72 test.php
hello world!
五、搜尋安裝PHP擴充套件
PHP擴充套件庫由PECL庫提供,擁有非常豐富的擴充套件程式,我們可以根據自己需要安裝使用。
# yum search php72
php72-php-pecl-handlebars-devel.x86_64 : php72-php-pecl-handlebars developer files (header)
php72-php-pecl-propro-devel.x86_64 : php72-php-pecl-propro developer files (header)
php72-php-pecl-psr-devel.x86_64 : php72-php-pecl-psr developer files (header)
php72-php-pecl-raphf-devel.x86_64 : php72-php-pecl-raphf developer files (header)
php72-php-pecl-swoole-devel.x86_64 : php72-php-pecl-swoole developer files (header)
php72-php-pecl-swoole2-devel.x86_64 : php72-php-pecl-swoole2 developer files (header)
省略內容....
# yum -y install 擴充套件包名
六、檢視PHP配置檔案位置
# php72 --ini
Configuration File (php.ini) Path: /etc/opt/remi/php72
Loaded Configuration File: /etc/opt/remi/php72/php.ini
Scan for additional .ini files in: /etc/opt/remi/php72/php.d
Additional .ini files parsed: /etc/opt/remi/php72/php.d/20-bz2.ini,
/etc/opt/remi/php72/php.d/20-calendar.ini,
/etc/opt/remi/php72/php.d/20-ctype.ini,
/etc/opt/remi/php72/php.d/20-curl.ini,
/etc/opt/remi/php72/php.d/20-exif.ini,
/etc/opt/remi/php72/php.d/20-fileinfo.ini,
/etc/opt/remi/php72/php.d/20-ftp.ini,
/etc/opt/remi/php72/php.d/20-gettext.ini,
/etc/opt/remi/php72/php.d/20-iconv.ini,
/etc/opt/remi/php72/php.d/20-json.ini,
/etc/opt/remi/php72/php.d/20-phar.ini,
/etc/opt/remi/php72/php.d/20-sockets.ini,
/etc/opt/remi/php72/php.d/20-tokenizer.ini
七、檢視PHP安裝了哪些擴充套件模組
# php72 -m
[PHP Modules]
bz2
calendar
Core
ctype
curl
date
exif
fileinfo
filter
ftp
gettext
hash
iconv
json
libxml
openssl
pcntl
pcre
Phar
readline
Reflection
session
sockets
SPL
standard
tokenizer
zlib
[Zend Modules]