DEV Community

Automata
Automata

Posted on

Install PHP 8.3 and config Apache in Ubuntu 22.04

Install PHP:

sudo apt install php8.3
Enter fullscreen mode Exit fullscreen mode

Install PHP module of Apache:

apt install libapache2-mod-php
Enter fullscreen mode Exit fullscreen mode

Config PHP Module of Apache

By default, the PHP module is automatically enabled, if for some reason it is not enabled, you should run:

a2enmod php8.3
Enter fullscreen mode Exit fullscreen mode

To update the PHP module configuration you must modify the files /etc/apache2/mods-enabled/php8.3.conf and /etc/apache2/mods-enabled/php8.*.load. Then you must restart the apache server by running the following command:

systemctl restart apache2.service
Enter fullscreen mode Exit fullscreen mode

Confirm Installation

php -v
Enter fullscreen mode Exit fullscreen mode

Optional Packages

PHP-CLI

Run PHP scripts via the CLI

apt install php-cli
Enter fullscreen mode Exit fullscreen mode

PHP-CGI

Execute PHP scripts without installing the Apache PHP module

sudo apt install php-cgi
Enter fullscreen mode Exit fullscreen mode

PHP-MySQL

apt install php-mysql
Enter fullscreen mode Exit fullscreen mode

PHP-PgSQL

apt install php-pgsql
Enter fullscreen mode Exit fullscreen mode

Top comments (0)