Learn more
If you have PHP 8.3 installed on your system but your web server is still using PHP 7.4 to execute PHP files, you need to configure your web server to use PHP 8.3. Here’s how you can do it depending on the web server you are using (Apache or Nginx).
For Apache
Check Installed PHP Versions:
Run the following command to check all PHP versions installed on your system:
sudo update-alternatives --config php
This will list all installed versions and allow you to choose the default version for the command line. However, this does not affect the web server.
Switching PHP Version for Apache:
You need to disable the current PHP module and enable the desired PHP module. Use the following commands:
sudo a2dismod php7.4
sudo a2enmod php8.3
Restart Apache:
After changing the PHP version, restart Apache to apply the changes:
sudo systemctl restart apache2