PHP is a strong net scripting language used to design interactive and dynamic web sites. “PHP 8.0” is the most recent model of PHP which can’t be put in instantly from the native repository on Debian. To put in the most recent PHP on Debian, an exterior repository shall be required.
This weblog is a information on how one can set up the most recent model of PHP, which is 8.0 on Debian.
Set up PHP on a Debian 11
The content material of this text is distributed below a number of headings that are:
Putting in PHP
To put in the most recent PHP model on Debian, observe the below-written steps:
Step 1: First replace/improve the repository of the system by utilizing the below-mentioned instructions:
sudo apt replace
sudo apt improve
After upgrading the repository, it is suggested to reboot the system so that every one the upgraded repositories can reload:
Step 2: Now set up the required dependencies utilizing the below-written command:
sudo apt set up -y lsb-release ca-certificates apt-transport-https software-properties-common gnupg2
Step 3: The most recent model of PHP is offered via the web site sury.org, so as to add the sury repository run the below-written command:
echo “deb https://packages.sury.org/php/ $(lsb_release -sc) important” | sudo tee /and many others/apt/sources.checklist.d/sury-php.checklist
Step 4: Additionally, import the sury repository key by utilizing the below-mentioned wget command:
wget -qO – https://packages.sury.org/php/apt.gpg | sudo apt-key add –
Step 5: Run the replace command to make sure that the repository is added efficiently:
Step 6: As soon as the repository is added efficiently then set up PHP 8.0 by operating the below-written apt command:
Step 7: To confirm that the set up of the most recent model of PHP is profitable run the below-written command:
Modules/Extensions of PHP
After putting in the most recent PHP model, now if you wish to discover out all of the accessible extensions/modules of PHP then run the below-written command:
From the above checklist of PHP modules, if you’re all in favour of putting in any of them then observe the below-written syntax:
sudo apt set up php8.0-<module identify in the checklist>
For instance:
sudo apt set up php8.0-bcmath
One may set up a number of modules at a time as proven under the place MySQL, XML and zip modules are put in at a time:
sudo apt set up php8.0-{mysql,xml,zip}
To search out the all of the put in/loaded modules of PHP, run the below-written command:
PHP Testing
To check the processing of put in PHP, let’s create a brand new php file utilizing the below-written command:
Then add a textual content message in it:
<?php echo ‘Good day Linux-hint’;
Now to execute the created .php file, observe the below-mentioned command:
Within the output, you possibly can see that the message textual content has been displayed efficiently, which implies php is working efficiently on the system;
Conclusion
To put in the most recent PHP model on Debian, customers first want to put in some dependencies on the system. After that, they’ve so as to add the sury repository after which replace the repository utilizing the “replace” command. Then, they will set up PHP 8.0 from the apt command with the required PHP modules proper after the repository replace.