Kako instalirati PHP 8.0 na openSUSE 15 Leap

PHP 8.0 značajno je ažuriranje PHP jezika objavljeno 26. studenog 2020., što je veliki korak naprijed u odnosu na postojeće izdanje PHP 7.4. Novi PHP sadrži mnoge nove značajke i optimizacije, uključujući imenovane argumente, vrste sindikata, atribute, promociju svojstava konstruktora, izraz podudaranja, null safe operatore, JIT i poboljšanja u sustavu tipova, rukovanje pogreškama i dosljednost.

U sljedećem tutorialu naučit ćete kako instalirati PHP 8.0 na openSUSE 15 Leap.

Preduvjeti

Ažurirajte operativni sustav

Ažurirajte svoj openSUSE operativni sustav kako biste bili sigurni da su svi postojeći paketi ažurirani:

sudo zypper refresh -y

Tutorial će koristiti sudo naredba i pod pretpostavkom da imate sudo status.

Za provjeru sudo statusa na svom računu:

sudo whoami

Primjer izlaza koji prikazuje sudo status:

[joshua@opensuse ~]$ sudo whoami
root

Da biste postavili postojeći ili novi sudo račun, posjetite naš vodič na dodavanje korisnika u Sudoers na openSUSE.

Za korištenje root račun, upotrijebite sljedeću naredbu s root lozinkom za prijavu.

su

Oglas


Uvezite i instalirajte PHP proširenja

Prvi zadatak je instalirati server:php:extensions u vašem openSUSE terminalu. Međutim, ovisno o verziji openSUSE-a koju trenutno koristite, to može varirati. U nastavku su dva primjera najnovijih i prethodnih izdanja openSUSE Leap.

Poslužitelj uvoza:php:extensions za openSUSE Leap 15.3:

sudo zypper addrepo https://download.opensuse.org/repositories/home:/Padom/15.3/home:Padom.repo

Poslužitelj uvoza:php:extensions za openSUSE Leap 15.2:

sudo zypper addrepo https://download.opensuse.org/repositories/server:php:extensions/openSUSE_Leap_15.2/server:php:extensions.repo

Poslužitelj uvoza:php:extensions za openSUSE Leap 15.1:

sudo zypper addrepo https://download.opensuse.org/repositories/server:php:extensions/openSUSE_Leap_15.1/server:php:extensions.repo

Primjer izlaza uvoza 15.3:

Kako instalirati PHP 8.0 na openSUSE 15 Leap

Za novija izdanja slijedite formulu. Kada završite, osvježite spremište.

sudo zypper refresh

Bit ćete upitani o ključu GPG i da ga odbijete, vjerujete privremeno ili uvijek.

Primjer:

Kako instalirati PHP 8.0 na openSUSE 15 Leap

Tip "a", a zatim pritisnite “GUMB ZA ENTER” za nastavak uvoza GPG ključa.

Instalirajte PHP 8.0

Sada kada ste uvezli i instalirali spremište PHP proširenja za vaš openSUSE sustav, instalirajte PHP 8.0 sljedećom naredbom.

sudo zypper install php8

Primjer rezultata:

Kako instalirati PHP 8.0 na openSUSE 15 Leap

Tip "Y", a zatim pritisnite "ENTER TIPKA" za nastavak instalacije.

Sada kada ste instalirali PHP 8.0 i proširenja provjerite verziju sljedećom naredbom:

php -v

Primjer izlaza u nastavku, zapamtite da će se s vremenom promijeniti:

PHP 8.0.11 (cli) (built: Sep 23 2021 12:00:00) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.11, Copyright (c) Zend Technologies

Oglas


Kako tražiti PHP 8.0 pakete

Prema zadanim postavkama, kada instalirate PHP 8.0, instalirano je samo nekoliko glavnih paketa. Međutim, kao što većina poznavatelja PHP-a zna, možete instalirati mnoge dodatne dodatke za različite aplikacije ili zahtjeve.

Za traženje dodatnih paketa u repozitoriju PHP proširenja, koristite sljedeću naredbu u svom terminalu.

sudo zypper search php8

Primjer rezultata:

Loading repository data...
Reading installed packages...

S  | Name                     | Summary                                                   | Type
---+--------------------------+-----------------------------------------------------------+-----------
   | php8                     | Interpreter for the PHP scripting language version 8      | srcpackage
i+ | php8                     | Interpreter for the PHP scripting language version 8      | package
   | php8-APCu                | APCu - APC User Cache                                     | srcpackage
   | php8-APCu                | APCu - APC User Cache                                     | package
   | php8-bcmath              | "Binary Calculator" extension for PHP                     | package
   | php8-bcmath-debuginfo    | Debug information for package php8-bcmath                 | package
   | php8-bz2                 | bzip2 codec support for PHP                               | package
   | php8-bz2-debuginfo       | Debug information for package php8-bz2                    | package
   | php8-calendar            | PHP8 Extension Module                                     | package
   | php8-calendar-debuginfo  | Debug information for package php8-calendar               | package
i  | php8-cli                 | Interpreter for the PHP scripting language version 8      | package
   | php8-cli-debuginfo       | Debug information for package php8-cli                    | package
i  | php8-ctype               | Character class extension for PHP                         | package
   | php8-ctype-debuginfo     | Debug information for package php8-ctype                  | package
   | php8-curl                | libcurl integration for PHP                               | package
   | php8-curl-debuginfo      | Debug information for package php8-curl                   | package
   | php8-dba                 | Database abstraction layer for PHP                        | package
   | php8-dba-debuginfo       | Debug information for package php8-dba                    | package
   | php8-debuginfo           | Debug information for package php8                        | package
   | php8-debugsource         | Debug sources for package php8                            | package
   | php8-devel               | PHP8 development files for C/C++ extensions               | package
i  | php8-dom                 | Document Object Model extension for PHP                   | package
   | php8-dom-debuginfo       | Debug information for package php8-dom                    | package
   | php8-enchant             | Spell checking extension for PHP                          | package
   | php8-enchant-debuginfo   | Debug information for package php8-enchant                | package
   | php8-exif                | EXIF metadata extensions for PHP                          | package
   | php8-exif-debuginfo      | Debug information for package php8-exif                   | package
   | php8-fileinfo            | File identification extension for PHP                     | package
   | php8-fileinfo-debuginfo  | Debug information for package php8-fileinfo               | package
   | php8-ftp                 | FTP protocol support for PHP                              | package
   | php8-ftp-debuginfo       | Debug information for package php8-ftp                    | package
   | php8-gd                  | GD Graphics Library extension for PHP                     | package
   | php8-gd-debuginfo        | Debug information for package php8-gd                     | package
   | php8-gettext             | Native language support for PHP                           | package
   | php8-gettext-debuginfo   | Debug information for package php8-gettext                | package
   | php8-gmagick             | Wrapper to the GraphicsMagick library                     | srcpackage
   | php8-gmagick             | Wrapper to the GraphicsMagick library                     | package
   | php8-gmp                 | Bignum extension for PHP                                  | package
   | php8-gmp-debuginfo       | Debug information for package php8-gmp                    | package
   | php8-gnupg               | PHP wrapper around the gpgme library                      | srcpackage
   | php8-gnupg               | PHP wrapper around the gpgme library                      | package
   | php8-ice                 | PHP framework delivered as C extension                    | srcpackage
   | php8-ice                 | PHP framework delivered as C extension                    | package
i  | php8-iconv               | Character set conversion functions for PHP                | package
   | php8-iconv-debuginfo     | Debug information for package php8-iconv                  | package
   | php8-imagick             | Wrapper to the ImageMagick library                        | srcpackage
   | php8-imagick             | Wrapper to the ImageMagick library                        | package
   | php8-intl                | ICU integration for PHP                                   | package
   | php8-intl-debuginfo      | Debug information for package php8-intl                   | package
   | php8-ldap                | LDAP protocol support for PHP                             | package
   | php8-ldap-debuginfo      | Debug information for package php8-ldap                   | package
   | php8-lzf                 | LZF compression                                           | srcpackage
   | php8-lzf                 | LZF compression                                           | package
   | php8-maxminddb           | PHP extension providing access to maxminddb databases     | srcpackage
   | php8-maxminddb           | PHP extension providing access to maxminddb databases     | package
   | php8-mbstring            | Multibyte string functions for PHP                        | package
   | php8-mbstring-debuginfo  | Debug information for package php8-mbstring               | package
   | php8-memcache            | PHP Memcache client Extension                             | srcpackage
   | php8-memcache            | PHP Memcache client Extension                             | package
   | php8-memcached           | PHP MemcacheD client Extension                            | srcpackage
   | php8-memcached           | PHP MemcacheD client Extension                            | package
   | php8-mysql               | MySQL database client for PHP                             | package
   | php8-mysql-debuginfo     | Debug information for package php8-mysql                  | package
   | php8-odbc                | ODBC extension for PHP                                    | package
   | php8-odbc-debuginfo      | Debug information for package php8-odbc                   | package
   | php8-opcache             | Opcode cache extension for PHP                            | package
   | php8-opcache-debuginfo   | Debug information for package php8-opcache                | package
i  | php8-openssl             | OpenSSL integration for PHP                               | package
   | php8-openssl-debuginfo   | Debug information for package php8-openssl                | package
   | php8-pcntl               | Process Control extension for PHP                         | package
   | php8-pcntl-debuginfo     | Debug information for package php8-pcntl                  | package
i  | php8-pdo                 | PHP Data Objects extension for PHP                        | package
   | php8-pdo-debuginfo       | Debug information for package php8-pdo                    | package
   | php8-pear                | PHP Extension and Application Repository                  | package
   | php8-pear                | PHP Extension and Application Repository                  | srcpackage
   | php8-pecl                | PHP Extension Community Library                           | package
   | php8-pgsql               | PostgreSQL database client for PHP                        | package
   | php8-pgsql-debuginfo     | Debug information for package php8-pgsql                  | package
   | php8-phar                | PHP Archive extension for PHP                             | package
   | php8-phar-debuginfo      | Debug information for package php8-phar                   | package
   | php8-posix               | POSIX functions for PHP                                   | package
   | php8-posix-debuginfo     | Debug information for package php8-posix                  | package
   | php8-psr                 | PSR Extension Module                                      | srcpackage
   | php8-psr                 | PSR Extension Module                                      | package
   | php8-readline            | PHP8 readline extension                                   | package
   | php8-readline-debuginfo  | Debug information for package php8-readline               | package
   | php8-redis               | API for communicating with Redis servers                  | srcpackage
   | php8-redis               | API for communicating with Redis servers                  | package
   | php8-shmop               | Alternate, low-level shared memory implementation for PHP | package
   | php8-shmop-debuginfo     | Debug information for package php8-shmop                  | package
   | php8-smbclient           | A PHP wrapper for libsmbclient                            | srcpackage
   | php8-smbclient           | A PHP wrapper for libsmbclient                            | package
   | php8-snmp                | SNMP extension for PHP                                    | package
   | php8-snmp-debuginfo      | Debug information for package php8-snmp                   | package
   | php8-soap                | SOAP/WSDL extension module for PHP                        | package
   | php8-soap-debuginfo      | Debug information for package php8-soap                   | package
   | php8-sockets             | Berkeley sockets API for PHP                              | package
   | php8-sockets-debuginfo   | Debug information for package php8-sockets                | package
   | php8-sodium              | Cryptographic Extension Based on Libsodium                | package
   | php8-sodium-debuginfo    | Debug information for package php8-sodium                 | package
i  | php8-sqlite              | SQLite database client for PHP                            | package
   | php8-sqlite-debuginfo    | Debug information for package php8-sqlite                 | package
   | php8-sysvmsg             | SysV Message Queue support for PHP                        | package
   | php8-sysvmsg-debuginfo   | Debug information for package php8-sysvmsg                | package
   | php8-sysvsem             | SysV Semaphore support for PHP                            | package
   | php8-sysvsem-debuginfo   | Debug information for package php8-sysvsem                | package
   | php8-sysvshm             | SysV Shared Memory support for PHP                        | package
   | php8-sysvshm-debuginfo   | Debug information for package php8-sysvshm                | package
   | php8-tidy                | PHP8 binding for the Tidy HTML cleaner                    | package
   | php8-tidy-debuginfo      | Debug information for package php8-tidy                   | package
i  | php8-tokenizer           | Extension module to access Zend Engine's PHP tokenizer    | package
   | php8-tokenizer-debuginfo | Debug information for package php8-tokenizer              | package
   | php8-uploadprogress      | An php extension to track progress of a file upload       | srcpackage
   | php8-uploadprogress      | An php extension to track progress of a file upload       | package
   | php8-uuid                | PHP UUID support functions                                | srcpackage
   | php8-uuid                | PHP UUID support functions                                | package
   | php8-xdebug              | Extended PHP debugger                                     | srcpackage
   | php8-xdebug              | Extended PHP debugger                                     | package
i  | php8-xmlreader           | Streaming XML reader extension for PHP                    | package
   | php8-xmlreader-debuginfo | Debug information for package php8-xmlreader              | package
i  | php8-xmlwriter           | Streaming-based XML writer extension for PHP              | package
   | php8-xmlwriter-debuginfo | Debug information for package php8-xmlwriter              | package
   | php8-xsl                 | PHP8 Extension Module                                     | package
   | php8-xsl-debuginfo       | Debug information for package php8-xsl                    | package
   | php8-zip                 | ZIP archive support for PHP                               | package
   | php8-zip-debuginfo       | Debug information for package php8-zip                    | package
   | php8-zlib                | Zlib compression support for PHP                          | package
   | php8-zlib-debuginfo      | Debug information for package php8-zlib                   | package

Da biste s popisa instalirali proširenje PHP 8.0 Redis, izvršili biste sljedeću naredbu:

sudo zypper install php8-redis

Primjer rezultata:

Kako instalirati PHP 8.0 na openSUSE 15 Leap

Tip "Y", a zatim pritisnite "ENTER TIPKA" za nastavak instalacije.

Isti princip se može koristiti za PHP 7.4. Samo zamijenite 8 sa 7.

sudo zypper search php7

Prema zadanim postavkama, svi paketi instalirani s php7 bit će PHP 7.4.

Kako instalirati PHP-FPM 8

Prema zadanim postavkama, modul Nginx FPM ne dolazi izvorno u PHP proširenjima od strane openSUSE. Da biste to instalirali, morat ćete instalirati jedno od spremišta zajednice. Jedna od preporučenih je Padomovo spremište koji je naveden kao alternativa u pretraživanju paketa openSUSE.

Prvo ćete morati dodati odgovarajuće spremište.

openSUSE Skok 15.3

sudo zypper addrepo https://download.opensuse.org/repositories/home:/Padom/15.3/home:Padom.repo

openSUSE Skok 15.2:

sudo zypper addrepo https://download.opensuse.org/repositories/home:Padom/openSUSE_Leap_15.2/home:Padom.repo

openSUSE Skok 15.1:

sudo zypper addrepo https://download.opensuse.org/repositories/home:Padom/openSUSE_Leap_15.1/home:Padom.repo

Osvježite spremište i prihvatite GPG uvoz spremišta koje ste odabrali.

sudo zypper refresh

Zatim instalirajte Nginx PHP-FPM 8 proširenje.

sudo zypper install php8-fpm

Bit ćete upitani o ključu GPG i da ga odbijete, vjerujete privremeno ili uvijek.

Primjer rezultata:

Kako instalirati PHP 8.0 na openSUSE 15 Leap

Tip "a", a zatim pritisnite “GUMB ZA ENTER” za nastavak uvoza GPG ključa.

Primjer rezultata:

Kako instalirati PHP 8.0 na openSUSE 15 Leap

Tip "Y", a zatim pritisnite "ENTER TIPKA" za nastavak instalacije.

Nakon instalacije, kopirajte zadane konfiguracijske datoteke na njihova imena.

Ako to ne učinite, PHP-FPM će dati status pogreške.

sudo cp /etc/php8/fpm/php-fpm.conf.default /etc/php8/fpm/php-fpm.conf
sudo cp /etc/php8/fpm/php-fpm.d/www.conf.default /etc/php8/fpm/php-fpm.d/www.conf

Sada, prema zadanim postavkama, PHP-FPM je onemogućen. Da biste omogućili PHP FPM da koristi sljedeću naredbu.

sudo systemctl enable php-fpm --now

Zatim potvrdite da PHP-FPM radi ispravno.

sudo systemctl status php-fpm

Primjer rezultata:

Kako instalirati PHP 8.0 na openSUSE 15 Leap

Kao što je gore navedeno, PHP-FPM radi ispravno i bit će ažuriran pomoću repozitorija zajednice. Alternativno, možete instalirati sva vaša PHP 8 proširenja iz ovog spremišta. Vrlo je cijenjen i, kao što je dodan FPM, ima više proširenja od službenog repozitorija.


Oglas


Komentari i zaključak

U tutorialu ste naučili kako uvesti repozitorij PHP proširenja za svoju verziju openSUSE-a te instalirati dodatne pakete i pretražiti ih. Općenito, PHP 8.0 sada svugdje počinje postati prilično standardan.

S razvojem nadolazećeg PHP 8.1, sve više programera sada svoje web aplikacije čini prilagođenim PHP 8, uključujući divovski CMS WordPress s više tema i dodataka koji se utrkuju kako bi dobili podršku za PHP 8.0 s obzirom na prednosti koje 8 ima u sigurnosti i brzini u usporedbi sa 7 niz.

4 misli o “Kako instalirati PHP 8.0 na openSUSE 15 Leap”

    • Pozdrav Chris,

      Da, u pravu si. Dodao sam FPM metodu jer bi ona bila možda popularnija.

      Apache će biti gotov kada shvatim nekoliko stvari, nešto je pokvareno u svim metodama koje sam isprobao, osobno sumnjam na pokvareni paket u spremištima.

      Kad to shvatim, dodat ću dio Apachea.

      Hvala na povratnoj informaciji.

      odgovor

Ostavite komentar