$schemamarkup = get_post_meta(get_the_ID(), 'schemamarkup', true); if(!empty($schemamarkup)) { echo $schemamarkup; }

LAMP PHP 8.x Installation in Ubuntu 22.04 – Step-by-step

March 8, 2022 | By the+gnu+linux+evangelist.

Installing

  1. 3. Installing LAMP

    To install LAMP PHP 8.x on Linux Ubuntu 22.04
    First, to Search for the latest PHP 8 release:

    apt search php8.

    Now run the following command for the actual default setup:

    sudo apt install apache2 php8.4 mysql-server mysql-client php8.4-mysql

    Alternatively, replace MySQL with MariaDB:

    Enable MariaDB Repo for Ubuntu

    Install with:

    sudo apt install apache2 php8.4 mariadb-server mariadb-client php8.4-mysql

    Verify PHP installation with:

    php -v
  2. 4. Searching PHP 8.x Extensions

    Search for available PHP 8.x extensions:

    sudo apt search php8.4

    Refine results using grep:

    sudo apt search php8.4 | grep [KEYWORD]

    Install useful modules for WordPress:

    sudo apt install php8.4-imagick php8.4-curl php8.4-gd php8.4-mbstring php8.4-xml php8.4-xmlrpc php8.4-soap php8.4-intl php8.4-zip
    Apt PHP 8 Search Results

    To install multiple packages at once:

    sudo apt install php8.4-{curl,xml,imagick,mysql,fpm,bz2}
  3. 5. Testing LAMP

    To test your LAMP web server installation, access the server’s document root:

    cd /var/www/html

    Create a PHP info file:

    sudo nano info.php

    For sudo issues, refer to: Enable sudo
    Add the following code:

    <?php
    phpinfo();
    ?>

    Ctrl+x to save and exit nano.

    Set www-data as the owner of the web server directory:

    sudo chown -R www-data:www-data /var/www

    Then open your browser at:
    http://localhost/info.php
    PHP Info Test

    You should see the PHP info page successfully.

    For creating an Apache 2 Virtual Host, see: GNU+Linux Apache2 VHost

    GNU/Linux Apache2 Virtual-Host Quick Start

Contents