
Cookies!
We use cookies to make your experience better!
This article guides you through the process of installing Apache Web Server with PHP 8.2 on an Ubuntu system. This setup is commonly used for hosting websites and web applications.
Before installing any new software, it's a good practice to update your system's package list. Open a terminal and execute the following command:
$ sudo apt update && sudo apt upgrade -y
Apache is one of the most popular web servers. Install it by running:
$ sudo apt install apache2 -y
Once installed, you can start and enable the Apache service:
$ sudo systemctl start apache2
$ sudo systemctl enable apache2
PHP 8.2 might not be available in the default Ubuntu repositories. You will need to add a third-party repository:
$ sudo add-apt-repository ppa:ondrej/php -y
$ sudo apt update
Install PHP 8.2 and commonly used extensions:
$ sudo apt install php8.2 libapache2-mod-php8.2 php8.2-cli php8.2-common php8.2-mysql php8.2-curl php8.2-xml php8.2-mbstring php8.2-zip -y
To ensure Apache uses PHP 8.2, you might need to disable the older version (if installed) and enable PHP 8.2:
$ sudo a2dismod php7.x # Replace 'x' with the specific version number if necessary
$ sudo a2enmod php8.2
$ sudo systemctl restart apache2
Create a PHP file to test the PHP installation:
$ echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/phpinfo.php
Now, open your web browser and navigate to http://your_server_ip/phpinfo.php
. You should see a page displaying information about the PHP version and configuration.
It's important to secure your Apache server:
You have successfully installed Apache with PHP 8.2 on your Ubuntu system. This setup forms the backbone for hosting various types of websites and web applications. For advanced configurations and optimization, refer to the Apache and PHP official documentation.
19 - 35
Our expert guides help you when you need them anywhere, anytime. [email protected]
Copyright © 2025 Pofii. All Rights Reserved., Made with by Pofii | PofiiUI X.
Lorem ipsum dolor sit amet consectetur adipisicing elit