How to Install PHP 7.4 on Debian 11 – Step-by-Step Guide

Install PHP 7.4 on Debian 11

Installing PHP 7.4 on Debian 11 is a crucial step for web developers and system administrators looking to run modern PHP applications. PHP 7.4 brings performance improvements and new features, making it a popular choice. This step-by-step guide will walk you through the process, ensuring a successful installation of PHP 7.4 on your Debian 11 system.

Step 1: Update the Package List

Before installing PHP 7.4, it’s essential to update the package list to ensure you’re getting the latest versions of the packages from the Debian repositories. Open a terminal and run the following command:

sudo apt update

Step 2: Install PHP 7.4 and Related Extensions

Now that the package list is up to date, it’s time to install PHP 7.4 and its commonly used extensions. Run the following command to install PHP and some frequently used extensions:

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

This command will install PHP 7.4, the PHP command-line interface, common libraries, and various extensions required for many PHP applications.

Step 3: Verify PHP Installation

To confirm that PHP 7.4 is successfully installed, run the following command:

php -v

You should see output similar to this:

PHP 7.4.x (cli) (built: Month day year hour:minute:second) ( NTS )

Step 4: Configure PHP Settings (Optional)

Depending on your application’s requirements, you may need to adjust some PHP settings. The main configuration file for PHP is typically located at /etc/php/7.4/cli/php.ini. Use a text editor like nano or vim to make changes:

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

Make the necessary modifications and save the file.

Step 5: Restart PHP and Web Server

After making changes to the PHP configuration, you must restart PHP and your web server (e.g., Apache or Nginx) for the changes to take effect:

sudo systemctl restart php7.4-fpm
sudo systemctl restart apache2  # or nginx

Congratulations!

You have successfully installed PHP 7.4 on Debian 11. By following this step-by-step guide, you now have a fully functional PHP environment to run your web applications smoothly. Remember to keep PHP and other system packages updated for security and performance reasons. Happy coding!

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:
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments