PHP是一門流行的腳本語言,用于Web開發(fā)。為了方便Linux用戶,php for linux也通過rpm包提供了安裝方式。
假設(shè)我們想要安裝PHP 7.3.10的RPM包,可以先下載相關(guān)RPM包:curl -O https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/o/oniguruma-6.8.2-1.el7.x86_64.rpm
curl -O https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/o/oniguruma-devel-6.8.2-1.el7.x86_64.rpm
curl -O https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/o/oniguruma-devel-6.8.2-1.el7.x86_64.rpm
curl -O https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/o/oniguruma-devel-6.8.2-1.el7.x86_64.rpm
curl -O https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/g/gmp-devel-6.0.0-15.el7.x86_64.rpm
curl -O https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/g/gd-last-2.3.0-1.el7.remi.x86_64.rpm
curl -O https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/g/gd-last-devel-2.3.0-1.el7.remi.x86_64.rpm
curl -O https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/o/oniguruma-php-6.8.2-1.el7.x86_64.rpm
curl -O https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/p/php-7.3.10-1.el7.remi.x86_64.rpm
curl -O https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/p/php-common-7.3.10-1.el7.remi.x86_64.rpm
curl -O https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/p/php-json-7.3.10-1.el7.remi.x86_64.rpm
curl -O https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/f/freetype-2.8-14.el7.x86_64.rpm
curl -O https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/f/freetype-devel-2.8-14.el7.x86_64.rpm
安裝依賴:sudo yum install oniguruma oniguruma-devel gmp-devel gd-last gd-last-devel freetype freetype-devel -y
安裝PHP:sudo yum install php-common php-json php oniguruma-php -y
啟用PHP:sudo systemctl enable php-fpm.service
查看PHP版本:php -v
至此,我們已經(jīng)成功安裝了PHP,并可以開始在Linux上進(jìn)行Web開發(fā)。