![]() ![]() Now you have learned how to install PHP 8.1 on your Ubuntu 22.04 server for Apache and Nginx and also how to upgrade or downgrade to a different PHP version. ![]() ![]() Save the file and exit the editor and restart Nginx for the changes to take effect. You need to replace the old PHP version with the new version.įastcgi_pass unix:/run/php/ ![]() The line you need to modify will look like this…įastcgi_pass unix:/run/php/ This will be located inside the location block location ~ .php$ Sudo service apache2 restart Upgrade/Downgrade PHP for Nginxįor Nginx you need to update or downgrade the PHP-FPM socket in your Nginx configration located inside the sites-available directory. Restart Apache for the changes to take effect. Replace the current enabled PHP version with your version. Disable the old PHP module ( below I have mentioned php 8.1, you need to use your other php version used by Apache) and enable the new PHP module using the following command. You need to tell Apache to use the correct PHP version you installed right now. If you want to use a different PHP version you can upgrade or downgrade to the other PHP version as shown below. Press to keep the current choice, or type selection number: Sudo update-alternatives -config php There are 3 choices for the alternative php (providing /usr/bin/php). You will be prompted with an interactive mode to choose your PHP version. Prepare yourself for a role working as an Information Technology Professional with Linux operating systemĪs you are switching PHP version for your web applications you will also need to change the PHP version in your CLI (Command Line Interface).Įxecute the below command to change PHP version on your CLI. Now you are having PHP 8.1 Installed and configured. Once you have updated your PHP FPM settings you need to restart it to apply the changes. Hit CTRL+X and Y to save the configuration and check if the configuration is correct and restart PHP. If you want to change the username name you can change the following lines by replacing the www-data with your username. Sudo nano /etc/php/8.1/fpm/pool.d/www.conf PHP-FPM allows you to configure the user and group that the service will run under. Sudo service php8.1-fpm restart Configure PHP 8.1 FPM Pools Once you have modified your PHP settings you need to restart your Apache for the changes to take effect.įor users with Nginx to who use PHP-FPM, you need to restart PHP-FPM. Hit F6 for search inside the editor and update the following values for better performance. Now we configure PHP for Web Applications by changing some values in php.ini file.įor PHP 8.1 with Apache the php.ini location will be in following directory.įor PHP 8.1 FPM with Nginx the php.ini location will be in following directory. With Zend OPcache v8.1.5, Copyright (c), by Zend Technologies Configure PHP 8.1 Zend Engine v4.1.5, Copyright (c) Zend Technologies You can easily verify PHP version using the below command. Sudo apt install php8.1-common php8.1-mysql php8.1-xml php8.1-xmlrpc php8.1-curl php8.1-gd php8.1-imagick php8.1-cli php8.1-dev php8.1-imap php8.1-mbstring php8.1-opcache php8.1-soap php8.1-zip php8.1-redis php8.1-intl -y Verify PHP Version Now, install some commonly used php-extensions with the following command. Installing PHP extensions are simple with the following syntax. ADVERTISEMENT php-fpm8.1 -v Install PHP 8.1 Extensions ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |