Installing PHP 7.4 on Debian 12: Step-by-Step Guide

Installing PHP 7.4 on Debian 12

Installing PHP 7.4 on Debian 12 is a fundamental task for developers and system administrators. PHP 7.4 offers enhanced performance and features. This guide walks you through the process, ensuring a smooth installation.

Step 1: Update Package Repository

Open the terminal and update the package repository to ensure you have the latest package information.

sudo apt update

Step 2: Install PHP 7.4

Use the following command to install PHP 7.4 along with commonly used extensions.

sudo apt install php7.4 php7.4-cli php7.4-fpm php7.4-json php7.4-common php7.4-mysql php7.4-zip php7.4-gd php7.4-mbstring php7.4-curl php7.4-xml php7.4-bcmath php7.4-json

Step 3: Verify Installation

Check if PHP 7.4 is successfully installed by running:

php -v

Step 4: Configure PHP

Edit the php.ini file to configure PHP settings. For example:

sudo nano /etc/php/7.4/cli/php.ini

Step 5: Restart Services

Restart PHP and web server for changes to take effect.

sudo systemctl restart php7.4-fpm
sudo systemctl restart apache2   # If using Apache

Step 6: Test PHP

Create a test PHP file in your web server’s root directory, for example, /var/www/html/info.php:

<?php
phpinfo();
?>

Access this file via a web browser (http://your_domain/info.php) to ensure PHP 7.4 is functioning.

Congratulations! You’ve successfully installed PHP 7.4 on Debian 12. This guide provided a step-by-step walkthrough, ensuring a seamless installation process. Harness the power of PHP 7.4 for your web development projects.

Remember to regularly update your server and PHP to ensure security and access to the latest features.

Expert in Information Technology In addition to general monitoring and notification system administration, I am actively engaged in providing information security, monitoring, and TCP/IP. I spend the most of my time configuring and routing computer networks. Reading and going to comedy concerts are two of my favorite pastimes.

Share the post if you liked it:
5 2 votes
Article Rating
Subscribe
Notify of
guest
3 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Yuliia Yakymchuk
Yuliia Yakymchuk
1 month ago

Thanks to this guide, I easily installed PHP 7.4 on Debian 12. The improved performance and additional features are what I found useful.

Arkadiusz Kalinowsk
Arkadiusz Kalinowsk
23 days ago

Это руководство помогло мне установить PHP 7.4 на Debian 12 без каких-либо проблем. Я был приятно удивлен улучшенной производительностью и новыми функциями, которые оказались очень полезными.

Tina Dosson
Tina Dosson
20 days ago

According to these instructions, I installed PHP 7.4 on Debian 12 and I really liked it.