Install PHP
Install PHP and the apache2 php support extension
sudo apt install php libapache2-mod-php
Test:
php -v- save info.php to your webroot (i.e. /var/www/html):
<?php phpinfo();and visit http://localhost/info.php
Install Extensions
In general:
- Install Extension, i.e.:
sudo apt-get install php-<foo> - May not be necessary or trigger loading already loaded extensions. Update php.ini (check location with
phpinfo()), i.e.:extension=<foo>(there is a section with many such lines, you may want to uncomment an existing line)
- Test by opening up a page containing
phpinfo()and locate a section for the module name.
See examples (aka requirements to host kirby cms):
mbstring
- Install module, i.e.:
sudo apt-get install php-mbstring UpdateExtension may already be loaded.php.inito include extension: search for;extension=mbstringand remove the;to uncomment the line.- Reload apache, i.e.
sudo systemctl reload apache2
curl
- Install module, i.e.:
sudo apt-get install php-curl UpdateExtension may already be loaded.php.inito include extension: search for;extension=curland remove the;to uncomment the line.- Reload apache, i.e.
sudo systemctl reload apache2
gd
- Install module, i.e.:
sudo apt-get install php-gd UpdateExtension may already be loaded.php.inito include extension: Add line includingextension=gd.- Reload apache, i.e.
sudo systemctl reload apache2
Locations
- ini:
/etc/php/<version>/apache2/php.ini