PHP installeren

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen

PHP 7.0 vs. 7.1

In jan. 2017 PHP 7.1 geïnstalleerd ipv. 5.x. Gaf zorgelijke foutmeldingen → Overgestapt naar PHP 7.0

Installatie januari 2023

Volgens Wikipedia, is 8.2 de laatste versie (januari 2023). Een commando zoals sudo apt install php8.2-cli werkt niet. Daarom:

sudo apt install php8.1-cli

Libraries

bcmath

Drupal Commerce vereist de bcmath PHP extension.

  • PHP 7.0: sudo apt-get install php7.0-bcmath
  • PHP 7.1: sudo apt-get install php-bcmath

curl

  • sudo apt-get install php7.0-curl - PHP 7.0
  • sudo apt-get install curl - PHP 7.1

Na herstart van de server, deed-ie 't nog steeds niet. Wel na herstarten van de computer. Zie ook [1]

gd

sudo apt-get install php7.0-gd # PHP 7.0
# sudo apt-get install gd      # PHP 7.1

mbstring

WooCommerce adviseert de mbstring-bibliotheek (april 2017). De WordPress-plugin Loco Translate werkt zelfs niet zonder deze plugin (okt. 2018).

Check je PHP-versie via Bash met

php -r \@phpinfo\(\)\; | grep 'PHP Version' -m 1

Installatie mbstring voor PHP 7.0:

sudo apt install php7.0-mbstring

Installatie mbstring voor actuele PHP-versie (7.2 in dit geval, okt. 2018):

sudo apt install php-mbstring

php_mycrypt

[2]:

sudo apt-get install mcrypt php5-mcrypt
sudo php5enmod mcrypt
sudo service apache2 restart

Configuratie ontwikkelserver - Casus jan. 2017

Debugging - In php.ini:

display_errors = On
log_errors = On
error_log = /var/log/php/errors.log