Otu esi etinye PHP 8 na Debian 11 Bullseye

PHP bụ otu n'ime asụsụ mmemme ihe nkesa na-ewu ewu na nke a na-ejikarị eme ihe ruo taa n'ahịa. Dabere na ọnụ ọgụgụ webụsaịtị PHP, na 2021, a ga-eji ya 79.1% nke niile mara weebụsaịtị dị ka W3Tech, na mbipute 7.0 usoro na-eme ka nnukwu na 65.6% òkè ahịa. Ọtụtụ CMS na-ewu ewu na frameworks dị ka WordPress, Magento, na Laravel mmepe gụnyere ọtụtụ PHP frameworks.

Ntọhapụ PHP kacha ọhụrụ ruo taa bụ usoro 8. PHP 8 bụ mmelite dị mkpa nke asụsụ PHP. Ọ nwere ọtụtụ atụmatụ na nkwalite ọhụrụ, gụnyere arụmụka akpọrọ aha, ụdị otu, njiri mara, nkwalite ihe nrụpụta, nkwupụta egwuregwu, onye na-ahụ maka nchekwa efu, JIT, nkwalite n'ụdị sistemu, njikwa njehie na nkwụsi ike.

N'ime nkuzi na-esote, ị ga-amụta ka esi etinye ebe nchekwa ọhụrụ site n'aka onye na-elekọta Debian Ondřej Surý ma wụnye PHP 8.0 ma wụnye ụdịdị n'ọdịnihu dị ka PHP 8.1 na-abata.

Prerequisites

  • OS akwadoro: Nnenna 11 Bullseye
  • Akaụntụ onye ọrụ: Akaụntụ onye ọrụ nwere sudo ma ọ bụ ohere mgbọrọgwụ.
  • Ngwungwu achọrọ: wget

Na-emelite Sistemụ Ọrụ

Mbụ, tupu ihe ọ bụla, melite gị Debian Sistemụ arụmọrụ iji hụ na ngwugwu niile dị adị adịla ugbu a:

sudo apt update && sudo apt full-upgrade -y

Mgbọrọgwụ ma ọ bụ Sudo Access

Site na ndabara, mgbe ị mepụtara akaụntụ gị na mmalite na Debian ma e jiri ya tụnyere nkesa ndị ọzọ, ọ naghị enweta ọkwa sudoers ozugbo. Ị ga-enwerịrị ike ịnweta ya mgbọrọgwụ paswọọdụ iji iwu su ma ọ bụ gaa na nkuzi nkuzi anyị Otu esi etinye onye ọrụ na Sudoers na Debian.

Wụnye ndabere achọrọ

Ị ga-mkpa inwe ngwugwu ndị a arụnyere maka nkuzi a. Mezue iwu a ka ịwụnye:

sudo apt-get install ca-certificates apt-transport-https software-properties-common -y

Rịba ama, ọ bụrụ na ejighị n'aka, mee iwu ahụ n'agbanyeghị; ọ gaghị emerụ sistemu gị.


Advertisement


Ịwụnye PHP 8 maka Debian 11

Bubata & Wụnye igodo GPG:

Nzọụkwụ mbụ bụ mbubata na wụnye ihe igodo GPG tupu ịtinye ebe nchekwa. Iji mee nke a, jiri ọnụ na-esonụ (Ctrl+ALT+T) iwu:

sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg

Mara, ị nwere ike ịwụnye ndabere ndị a ma ọ bụrụ na ị nwere nsogbu:

sudo apt install apt-transport-https lsb-release ca-certificates

Bubata & Wụnye ebe nchekwa:

Iji hazie igodo GPG, oge eruola ịgbakwunye ya Ondřej Surý repository dị ka ndị a:

sudo sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'

Tinye PHP 8

Ugbu a ị nwere ike ịga n'ihu ịwụnye PHP 8 maka mkpa gị dị ka ndị a:

Wụnye Nhọrọ Modul Apache

Iji tinye PHP 8 dị ka modul Apache, tinye iwu a.

sudo apt update && sudo apt install php8.0 libapache2-mod-php8.0

Ozugbo echichi mechara, malitegharịa ihe nkesa Apache gị maka ibunye modul PHP ọhụrụ.

sudo systemctl restart apache2

Wụnye Nhọrọ Module Apache na FPM

PHP-FPM (acronym nke FastCGI Process Manager) bụ PHP ọzọ na-ewu ewu (Ihe nhazi Hypertext) FastCGI mmejuputa.

Iji tinye PHP-FPM maka Apache 2, jiri iwu ndị a.

sudo apt update && sudo apt install php8.0-fpm libapache2-mod-fcgid

Mara, na ndabara, PHP-FPM adịghị enyere Apache aka. Ị ga-emerịrị ya site n'iwu a.

sudo a2enmod proxy_fcgi setenvif && sudo a2enconf php8.0-fpm

N'ikpeazụ, malitegharịa Apache.

sudo systemctl restart apache2

Chọpụta na PHP-FPM na-arụ ọrụ:

sudo systemctl status php8.0-fpm

Ihe atụ mmepụta:

Otu esi etinye PHP 8 na Debian 11 Bullseye

PHP 8 nwere nhọrọ Nginx

Nginx enweghị nhazi PHP nke ala dịka ụfọdụ sava weebụ ndị ọzọ dị ka Apache. Ị ga-achọ ịwụnye PHP-FPM "onye njikwa usoro fastCGI" ijikwa faịlụ PHP.

Iji tinye PHP 8 na Nginx, jiri iwu a:

sudo apt install php8.0-fpm php8.0-cli -y

Ugbu a, gosi na ọ na-agba ọsọ:

sudo systemctl status php8.0-fpm

Ihe atụ mmepụta:

Otu esi etinye PHP 8 na Debian 11 Bullseye

Okwu na mmechi

PHP 8 bụ nkwalite karịa 7.4, yana ngwa ngwa ihe na-atọ ụtọ n'etiti ọtụtụ atụmatụ. Agbanyeghị, ị ga-amarịrị na anaghị ewere ya dị ka “ngwa ngwa tozuru oke” ma e jiri ya tụnyere PHP 7.4. Ị nwere ike ịhụ na ọtụtụ ngwanrọ ọkacha mmasị gị dị ka WordPress ma ọ bụ Plugins/Themes maka ngwa CMS nwere ike ịgbagha.

Mee ụfọdụ nyocha, kwadebe, ma tinye 7.4 ma dị njikere iji dochie anya ma ọ bụrụ na ihe ọ bụla na-ezighị ezi mgbe ị na-eme mgbanwe ahụ, dịka 7.4 ka na-arụsi ọrụ ike na ngwugwu na-agbanye n'otu oge yana ngwugwu 8.

Ahapụ a Comment