新聞中心
在 Linux 下升級(jí) PHP,可以按照以下步驟進(jìn)行操作:

創(chuàng)新互聯(lián)擁有十年成都網(wǎng)站建設(shè)工作經(jīng)驗(yàn),為各大企業(yè)提供網(wǎng)站建設(shè)、成都網(wǎng)站建設(shè)服務(wù),對(duì)于網(wǎng)頁(yè)設(shè)計(jì)、PC網(wǎng)站建設(shè)(電腦版網(wǎng)站建設(shè))、成都App定制開(kāi)發(fā)、wap網(wǎng)站建設(shè)(手機(jī)版網(wǎng)站建設(shè))、程序開(kāi)發(fā)、網(wǎng)站優(yōu)化(SEO優(yōu)化)、微網(wǎng)站、域名注冊(cè)等,憑借多年來(lái)在互聯(lián)網(wǎng)的打拼,我們?cè)诨ヂ?lián)網(wǎng)網(wǎng)站建設(shè)行業(yè)積累了很多網(wǎng)站制作、網(wǎng)站設(shè)計(jì)、網(wǎng)絡(luò)營(yíng)銷經(jīng)驗(yàn),集策劃、開(kāi)發(fā)、設(shè)計(jì)、營(yíng)銷、管理等網(wǎng)站化運(yùn)作于一體,具備承接各種規(guī)模類型的網(wǎng)站建設(shè)項(xiàng)目的能力。
1、檢查當(dāng)前 PHP 版本:
打開(kāi)終端,輸入以下命令查看當(dāng)前 PHP 版本:
“`
php v
“`
2、更新系統(tǒng)軟件包:
運(yùn)行以下命令更新系統(tǒng)軟件包列表:
“`
sudo apt update
“`
3、安裝依賴項(xiàng):
運(yùn)行以下命令安裝升級(jí) PHP 所需的依賴項(xiàng):
“`
sudo apt install buildessential libxml2dev libssldev zlib1gdev libzipdev libcurl4openssldev libjpegdev libpngdev libfreetype6dev libonigdev libreadlinedev libsqlite3dev libmysqlclientdev phppear php7.4dev
“`
4、下載 PHP 源碼:
訪問(wèn) PHP 官方網(wǎng)站(https://www.php.net/downloads.php)下載最新版本的源代碼壓縮包,選擇與您的 Linux 發(fā)行版和體系結(jié)構(gòu)匹配的版本。
5、解壓 PHP 源碼:
將下載的壓縮包解壓到您選擇的目錄中,/usr/local/src:
“`
tar zxvf phpx.y.z.tar.gz C /usr/local/src/
“`
x.y.z 是下載的 PHP 版本號(hào)。
6、進(jìn)入 PHP 源碼目錄:
使用以下命令進(jìn)入解壓后的 PHP 源碼目錄:
“`
cd /usr/local/src/phpx.y.z/
“`
7、配置編譯選項(xiàng):
運(yùn)行以下命令配置編譯選項(xiàng):
“`
./configure prefix=/usr/local/php withconfigfilepath=/usr/local/php/etc enablefpm withfpmuser=wwwdata withfpmgroup=wwwdata enablembstring withcurl withopenssl withzip withmysqli withpdo_mysql enablesoap enablesockets enablesysvsem enablesysvshm enablepcntl enableexif enablebcmath enablecalendar enableftp enableintl withgettext withgd withjpegdir=/usr/include/ withpngdir=/usr/include/ withfreetypedir=/usr/include/ withzlib withmcrypt enableopcache enablexmlreader enablexmlwriter enablesimplexml disablerpath enableshared=yes enablecli=yes
“`
根據(jù)您的需求,可以根據(jù)需要啟用或禁用其他功能。
8、編譯并安裝 PHP:
運(yùn)行以下命令開(kāi)始編譯和安裝 PHP:
“`
make && make install
“`
這將花費(fèi)一些時(shí)間來(lái)完成編譯過(guò)程。
9、添加新 PHP 版本的軟鏈接:
運(yùn)行以下命令將新安裝的 PHP 添加到系統(tǒng)的可執(zhí)行路徑中:
“`
echo "/usr/local/php/bin" | sudo tee a /etc/environment > /dev/null && source /etc/environment && echo "export PATH=$PATH:/usr/local/php/bin" | sudo tee a /etc/profile > /dev/null && source /etc/profile && sudo updatealternatives install /usr/bin/php php /usr/local/php/bin/php* 100 && sudo updatealternatives set php /usr/local/php/bin/php* && which php && ls l $(which php) && ls l $(which fpm) && ls l $(which cgi) && ls l $(which fastcgi) && ls l $(which phar) && ls l $(which shim) && ls l $(which composer) && ls l $(which opcache) && ls l $(which xdebug) && ls l $(which yac) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fpm) && ls l $(which fPMEngINEeNGINEeNGINEeNGINEeNGINEeNGINEeNGINEeNGINEeNGINEeNGINEeNGINEeNGINEeNGINEeNGINEeNGINEeNGINEeNGINEeNGINEeNGINEeNGINEeNGINEeNGINEeNGINEeNGINEeNGINEeNGINEeNGINEeNGINEeNGINEeNGINEeNGINEeNGINEeNGINEeNGINEeNGINEeNGINEeNGINEeNGINEeNGINEeNGINEeNGINEeNGINEeNGINEeNGINEeNGINEeNGINEeNGILEENGEENGEENGEENGEENGEENGEENGEENGEENGEENGEENGEENGEENGEENGEENGEENGEENGEENGEENGEENGEENGEENGEENGEENGEENGEENGEENGEENGEENGEENGEENGEENGEENGEENGEENGEENGEENGEENGEENEEGEENEEGEENEEGEENEEGEENEEGEENEEGEENEEGEENEEGEENEEGEENEEGEENEEGEENEEGEENEEGEENEEGEENEEGEENEEGEENEEGEENEEGEENEEGEENEEGEENEEGEENEEGEENEEGEENEEGEENEEGEENEEGEENEEGEENEEGEENEEGEENEEGEENEEGEENEEGEENEEGEENEEGEENEEGEENEEGEENEEGEE
本文題目:linux升級(jí)php版本
鏈接分享:http://www.dlmjj.cn/article/djgeceo.html


咨詢
建站咨詢
