Effortless Setup: Install PHP 8.2 on Rocky Linux 8

This tutorial provides a straightforward, step-by-step guide to installing PHP 8.2 on Rocky Linux 8, enabling you to develop and deploy modern web applications with PHP.

rocky linux php
Large
VPS
3
vCPU
12 GB
Memory
120 GB
NVMe Disk
6144 GB
Traffic
29.90
/month
* Up to 6 vCPU, 36GB RAM, 360GB NVMe Disk Space and 1Gbit/s Network Speed
#### Prerequisites Before you begin, ensure you have: - A server or workstation running Rocky Linux 8 - A user account with sudo privileges - Basic familiarity with the command line #### Step 1: Add Remi Repository Install the Remi repository, which provides the latest PHP versions: ```bash sudo dnf install -y dnf-utils sudo dnf install -y https://rpms.remirepo.net/enterprise/remi-release-8.rpm ``` #### Step 2: Enable PHP 8.2 Repository Enable the PHP 8.2 repository: ```bash sudo dnf module enable php:remi-8.2 -y ``` #### Step 3: Install PHP 8.2 Install PHP 8.2 and necessary PHP extensions: ```bash sudo dnf install -y php php-cli php-fpm php-mysqlnd php-zip php-devel php-gd php-mbstring php-curl php-xml php-pear php-bcmath php-json ``` #### Step 4: Verify PHP Installation Check the installed PHP version: ```bash php --version ``` You should see output similar to: ``` PHP 8.2.x (cli) (built: ...) ``` #### Step 5: Configure PHP (Optional) Adjust PHP settings as needed in the php.ini configuration file located at `/etc/php.ini`. #### Step 6: Test PHP Create a simple PHP script to test your installation: ```bash echo "" | sudo tee /var/www/html/info.php ``` Access `http://your_server_ip/info.php` from a web browser to see PHP information. #### Conclusion You have successfully installed PHP 8.2 on Rocky Linux 8. PHP 8.2 provides new features and improvements for developing modern web applications on your system. **Additional Resources:** - **PHP Official Documentation:** [https://www.php.net/docs.php](https://www.php.net/docs.php) - **Remi Repository Documentation:** [https://rpms.remirepo.net/](https://rpms.remirepo.net/) - **Rocky Linux Documentation:** [https://docs.rockylinux.org/](https://docs.rockylinux.org/)

Related Tutorials



    Created with ❤ at Estonia
    EcoStack Technology OÜ