Otu esi etinye PHP 8.1 na Fedora 35

PHP 8.1 bụ mmelite dị ịrịba ama nke asụsụ PHP nke a ga-ewepụta na Nọvemba 25, 2021. Nke a bụ nkwalite ọkọlọtọ na-aga n'ihu site na ntọhapụ PHP 8.0 dị ugbu a na PHP 8.1 ọhụrụ na-eweta enums, fibers, adịghị alaghachi azụ ụdị, ikpeazụ. klaasị na-adịgide adịgide, ụdị nkwụsịtụ, ihe ndị na-agụ naanị n'ime ndepụta ogologo nke atụmatụ ọhụrụ na mgbanwe.

N'ime nkuzi a, ị ga-amụta otu esi ebubata Module REMI wee wụnye PHP 8.1 na sistemụ Fedora 35 gị.

Prerequisites

  • OS akwadoro: Linux Fedora 35
  • Akaụntụ onye ọrụ: Akaụntụ onye ọrụ nwere sudo ma ọ bụ ohere mgbọrọgwụ.

Melite Sistemụ Ọrụ

Melite gi Fedora Sistemụ arụmọrụ iji hụ na ngwugwu niile dị adị adịla ugbu a:

sudo dnf upgrade --refresh -y

Nkuzi a ga-eji ya sudo iwu na na-eche na ị nwere ọnọdụ sudo.

Iji nyochaa ọkwa sudo na akaụntụ gị:

sudo whoami

Ihe atụ na-egosi ọkwa sudo:

[joshua@fedora ~]$ sudo whoami
root

Ka ịtọlite ​​akaụntụ sudo dị adị ma ọ bụ ọhụrụ, gaa na nkuzi anyị na Na-agbakwunye onye ọrụ na Sudoers na Fedora.

Iji mgbọrọgwụ akaụntụ, jiri iwu na-esonụ na paswọọdụ mgbọrọgwụ banye.

su

Wụnye ndabere achọrọ

Tupu ị gaa n'ihu na nrụnye, gbaa iwu a ka ịwụnye ma ọ bụ lelee na ngwugwu dnf-plugins-core arụnyere na desktọpụ Fedora gị.

sudo dnf install dnf-plugins-core -y

Site na ndabara, ekwesịrị itinye nke a.


Advertisement


Wụnye ebe nchekwa PHP 8.1 Remi

Ugbu a, PHP 8.1 adịghị egosipụta na Fedora 35, agbanyeghị nke a nwere ike idozi ya ngwa ngwa site na ịwụnye ma mee ka Remi Repository nke bụ a. Ebe nchekwa YUM/DNF n'efu ma kwụsie ike tumadi maka nchịkọta PHP. O nwere ngwugwu maka ụdị PHP kacha ọhụrụ.

Ka ịwụnye mbubata na wụnye remi repo, jiri ihe ndị a (dnf) iwu ọnụ:

sudo dnf install http://rpms.remirepo.net/fedora/remi-release-35.rpm

Na-esote, nyochaa nwụnye.

dnf repolist | grep remi

Ihe atụ mmepụta:

remi-modular                  Remi's Modular repository - Fedora 35 - x86_64

Kwado ebe nchekwa PHP 8.1 (Remi).

PHP 8.0 bụ ndabara PHP nhọrọ maka ọkọlọtọ Fedora 35 nrụnye.

Ndụmọdụ dị ngwa bụ iji (depụta php) iwu ka ịhụ nhọrọ dị na ndabara.

Iwu ndepụta dnf modul a nwere ike ime nke a:

sudo dnf module list php

Mara, a ga-akpali gị ibubata igodo GPG maka ebe nchekwa Remi. Ụdị (NA) ịga n'ihu ma ọ bụrụ na ị zutere ya.

Ịtọgharịa ndepụta PHP dị mfe site na iwu a:

sudo dnf module list reset php -y

Na-esote, mee ka PHP 8.1 jiri iwu a:

sudo dnf module enable php:remi-8.1

Ihe atụ mmepụta:

Otu esi etinye PHP 8.1 na Fedora 35

Advertisement


Wụnye PHP 8.1 na Fedora

Ugbu a ị gbakwunyela ebe nchekwa PHP Remi wee mee ka PHP 8.1 bụrụ ụdị ndabara na sistemụ Fedora gị, ị nwere ike iwunye PHP 8.1 site na iwu a:

sudo dnf install php

Ihe atụ mmepụta:

Otu esi etinye PHP 8.1 na Fedora 35

ụdị "Y," wee pịa "Tinye igodo" ịga n'ihu na nwụnye.

Mara, a ga-akpali gị maka ibubata igodo GPG ọzọ.

Ihe Nlereanya:

Otu esi etinye PHP 8.1 na Fedora 35

ụdị "Y," wee pịa "Tinye igodo" ịga n'ihu na nwụnye.

Nhọrọ, ọ bụrụ na ịchọrọ ịwụnye ndọtị ndị a na-ejikarị maka PHP 8.1, jiri iwu na-esonụ:

sudo dnf install php-cli php-fpm php-curl php-mysqlnd php-gd php-opcache php-zip php-intl php-common php-bcmath php-imagick php-xmlrpc php-json php-readline php-memcached php-redis php-mbstring php-apcu php-xml

Mara, wepụ nhọrọ ndị ị na-achọghị nke a bụ nhọrọ.

Ihe atụ mmepụta:

Otu esi etinye PHP 8.1 na Fedora 35

ụdị "Y," wee pịa "Tinye igodo" ịga n'ihu na nwụnye.

Ugbu a ị tinyela PHP 8.1 na mgbakwunye, lelee ụdị ahụ site na iwu a:

php -v

Ihe atụ mmepụta:

Otu esi etinye PHP 8.1 na Fedora 35

Ntinye PHP-FPM nke PHP 8.1

N'adịghị ka nrụnye PHP-FPM na Debian/Ubuntu na-eji (www-data) onye ọrụ, nke a abụghị ikpe maka nrụnye ezinụlọ RHEL. Site na ndabara na AlmaLinux, a haziri ọrụ PHP-FPM ka a na-agba ya (apache) onye ọrụ, nke ezighi ezi ebe ọ bụ na anyị na-eji Nginx, nke a kwesịrị ka edozi ya.

Nke mbụ, meghere ndị a (www.conf) nhazi faịlụ:

sudo nano /etc/php-fpm.d/www.conf

Na-esote, dochie (apache) onye ọrụ na otu na (Nginx) onye ọrụ na otu:

Otu esi etinye PHP 8.1 na Fedora 35

Ka ịchekwaa, pịa (CTRL+O) wee pụọ (CTRL+X).

Ugbu a, ị ga-ebugharị ma ọ bụ malitegharịa ọrụ PHP-FPM gị:

sudo systemctl restart php-fpm

Nhazi Nginx

Ihe nkesa nke Nginx chọrọ ihe atụ n'okpuru maka Nginx iji hazie faịlụ PHP.

N'okpuru ebe a, ọmụmaatụ maka ihe nkesa niile na-edozi faịlụ PHP nke chọrọ ebe ~ .php$ gbakwunyere.

server {
 # … some other code
 # Pass the php scripts to FastCGI server specified in upstream declaration.
	location ~ \.php(/|$) {
		include fastcgi.conf;
                fastcgi_pass unix:/run/php-fpm/www.sock;
		fastcgi_split_path_info ^(.+\.php)(/.*)$;
		fastcgi_param PATH_INFO $fastcgi_path_info;
		fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
		fastcgi_param DOCUMENT_ROOT $realpath_root;
		try_files $uri $uri/ /app.php$is_args$args;
		fastcgi_intercept_errors on;	
	}
}

Nwalee Nginx iji jide n'aka na ị nweghị mmejọ na mgbanwe ndị e mere na koodu dị n'elu; tinye ihe ndia.

sudo nginx -t

Ihe atụ mmepụta:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Malitegharịa ọrụ Nginx maka nrụnye ka ọ zuru oke.

sudo systemctl restart nginx

Advertisement


Okwu na mmechi

N'ime nkuzi a, ị mụtala ka esi etinye PHP 8.1 wee hazie otu esi eji ya na Apache na Nginx. PHP 8.1 na-atọ ụtọ. Otú ọ dị, n'oge ugbu a, ọ ka na-apụta na beta ma ọ bụghị na-ewere ya dị ka ọ kwụsiri ike, dị ka 8.0 ma ọ bụ 7.4 anụ ahụ ochie, ya mere kpachara anya na ị nwere ike ịhụ na ọtụtụ n'ime ngwanrọ ọkacha mmasị gị dị ka WordPress ma ọ bụ Plugins / Gburugburu maka CMS software nwere ike esemokwu. ruo mgbe ndị mmepe nwere ike imelite.

Mee ụfọdụ nyocha, kwadebe, ma tinye PHP 7.4 ma ọ bụ 8.0 ma dị njikere iji dochie anya ma ọ bụrụ na ihe ọ bụla na-ezighị ezi mgbe ị na-eme mgbanwe ahụ. Ụdị kwụsiri ike dị ka 8.0 ka na-arụsi ọrụ ike, a na-agbanyekwa ngwugwu n'otu oge yana ngwugwu 8.1.

Idenye aha
Gwa nke
0 Comments
Inline nzaghachi
Lee echiche niile
0
Ga-ahụ n'anya gị echiche, biko okwu.x