PHP is a popular server-side scripting language that is widely used for web development. It stands for "PHP: Hypertext Preprocessor" and was originally created by Rasmus Lerdorf in 1994. PHP is designed to be embedded within HTML code, allowing developers to dynamically generate web content.
To install PHP 8.2 for Nginx on Debian 12, you can follow these steps:
Step 1 : Import the GPG key for the repository:
Step 2 : Add the repository to your system's sources:
Step 3 : Update the package lists to include the new repository:
Step 4 : Install PHP 8.2:
Step 5 : Install the requested extensions
Step 6 : Configure Nginx to use PHP-FPM:
Find the location ~ \.php$
block and modify it as follows:
Save and exit the file.
Step 7 : Restart Nginx to apply the changes:
Step 8 : To test if PHP-FPM is working correctly, you can create a PHP info file. Create a file called info.php
in the web root directory (/var/www/html/
) with the following content:
Add the following lines to the file:
Save and exit the file.
Step 9 : Now, open a web browser and visit http://localhost/info.php
. You should see the PHP information page, which confirms that PHP 8.2 and PHP-FPM are installed and functioning correctly with Nginx.
PHP 8.2 with PHP-FPM is now installed and configured to work with Nginx on Debian 12. You can now develop and host PHP-based web applications using Nginx as your web server.