溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

如何安裝php(centos8)

發(fā)布時間:2020-11-17 10:15:58 來源:億速云 閱讀:244 作者:小新 欄目:編程語言

這篇文章主要介紹如何安裝php(centos8),文中介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們一定要看完!

                                                       

快如閃電的安裝php(centos8)

本文只考慮centos8

remi是一個php安裝倉庫。是rpm包。

用了國內(nèi)鏡像會速度極快,下載包的速度:3MB/秒,驚人的快!

無論docker還是centos環(huán)境都非常的快?。?br/>

首先,安裝阿里的 centos 倉庫。

curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.reporm -f  /etc/yum.repos.d/CentOS-centosplus.reporm -f  /etc/yum.repos.d/CentOS-PowerTools.reporm -f  /etc/yum.repos.d/CentOS-Extras.reporm -f  /etc/yum.repos.d/CentOS-AppStream.repo
dnf makecache
dnf repolist

安裝阿里的 epel 倉庫。

dnf install -y epel-releasesed -i 's|^#baseurl=https://download.fedoraproject.org/pub|baseurl=https://mirrors.aliyun.com|' /etc/yum.repos.d/epel*sed -i 's|^metalink|#metalink|' /etc/yum.repos.d/epel*
dnf makecache
dnf repolist

安裝阿里的 remi 的倉庫

dnf install -y https://mirrors.aliyun.com/remi/enterprise/remi-release-8.rpmsed -i  's/https*:\/\/rpms.remirepo.net/https:\/\/mirrors.aliyun.com\/remi/g'  /etc/yum.repos.d/remi*sed -i 's/#baseurl/baseurl/g' /etc/yum.repos.d/remi*

快如閃電的最關(guān)鍵是下一句,清除鏡像列表??!否則又去讀取國外的鏡像了。

sed -i 's|^mirrorlist|#mirrorlist|' /etc/yum.repos.d/remi*

dnf makecache
dnf repolist

安裝 php

dnf install -y yum-utils

dnf install -y php74 php74-php-devel  php74-php-fpm  php74-php-mbstring php74-php-memcache php74-php-memcached php74-php-redis  php74-php-mysqlnd  php74-php-pdo  php74-php-bcmath php74-php-xml php74-php-gd php74-php-gmp php74-php-igbinary php74-php-imagick   php74-php-mcrypt  php74-php-pdo_mysql php74-php-posix php74-php-simplexml  php74-php-opcache php74-php-xsl php74-php-xmlwriter php74-php-xmlreader php74-php-swoole php74-php-zip php74-php-phalcon  php74-php-yaml php74-php-yar php74-php-yaf php74-php-uuid

體驗到快如閃電的速度了吧!

最后安裝阿里的 composer 鏡像源

ln -s /usr/bin/php74 /usr/bin/phpcurl -o /usr/local/bin/composer https://mirrors.aliyun.com/composer/composer.pharchmod +x /usr/local/bin/composer

注意觀察,確認安裝成功,且大版本是2.0

composer -V

立刻設(shè)置composer 的鏡像源為阿里

composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/

安裝 nginx

cat>/etc/yum.repos.d/nginx.repo<<EOF
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/\$releasever/\$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
EOFdnf install -y nginx
nginx -v
systemctl enable nginx

以上是如何安裝php(centos8)的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對大家有幫助,更多相關(guān)知識,歡迎關(guān)注億速云行業(yè)資訊頻道!

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI