linux下安裝php7.3
阿新 • • 發佈:2021-10-18
新增軟體源
CentOS
安裝 EPEL 源:
yum install epel-release
安裝 REMI 源:
CentOS 7:
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
安裝 Yum 源管理工具:
yum install yum-utils
安裝軟體
安裝 PHP7.3:
yum install -y php73-php-fpm php73-php-cli php73-php-bcmath php73-php-gd php73-php-json php73-php-mbstring php73-php-mcrypt php73-php-mysqlnd php73-php-opcache php73-php-pdo php73-php-pecl-crypto php73-php-pecl-mcrypt php73-php-pecl-geoip php73-php-recode php73-php-snmp php73-php-soap php73-php-xmll
設定 PHP
查詢安裝包:rpm -qa | grep 'php'
找到:php73-php-fpm-7.3.6-1.el7.remi.x86_64安裝位置(版本不同名稱會有不同,找php-fpm就可以)
rpm -ql php73-php-fpm-7.3.31-1.el7.remi.x86_64
查詢php.ini位置:find /etc/opt/remi/php73 -name php.ini
編輯/etc/opt/remi/php73/php.ini替換換 ;cgi.fix_pathinfo=1 為 cgi.fix_pathinfo=0
快捷命令:sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/' /etc/opt/remi/php73/php.ini
重啟:
service php73-php-fpm restart
是否安裝成功
php73 -v
設定開機啟動
systemctl enable php73-php-fpm
systemctl start php73-php-fpm