Actions

User

User:Gold/PHP 8 Scratchpad/Add PHP8

From Mahara Wiki

< User:Gold‎ | PHP 8 Scratchpad
Revision as of 15:01, 16 Mayıs 2022 by Gold (talk | contribs) (Created page with "== Check available versions == <syntaxhighlight lang=bash> gold@shipnet:~/$ apt-cache search php | sort | grep fpm php7.4-fpm - server-side, HTML-embedded scripting language (...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Check available versions

gold@shipnet:~/$ apt-cache search php | sort | grep fpm
php7.4-fpm - server-side, HTML-embedded scripting language (FPM-CGI binary)
php-fpm - server-side, HTML-embedded scripting language (FPM-CGI binary) (default)

If there are no php 8 options we need to add the repo and check again.

gold@shipnet:~/$ sudo add-apt-repository ppa:ondrej/php

You will likely be challenged to install ppa:ondrej/apache2. We are not using mod-php so there is no need to do that.

To check php8 is available rerun the apt-cache call above. You should see many more options.

Install PHP 7.4 and 8.1

Testing on PHP 7.4 and PHP 8.1 so install the related supporting packages that Mahara needs. There is no php8.1-json package. This is part of php8.1-common now.

gold@shipnet:~/$ sudo apt install \
  php7.4-cli php7.4-common php7.4-curl php7.4-gd \
  php7.4-json php7.4-ldap php7.4-mbstring php7.4-pgsql  \
  php7.4-xml php7.4-xmlrpc php7.4-zip \
  php8.1-cli php8.1-common php8.1-curl php8.1-gd \
  php8.1-ldap php8.1-mbstring php8.1-pgsql php8.1-xml \
  php8.1-xmlrpc php8.1-zip