Php not running after updating on ubuntu. what to do?

Sometimes, after updating PHP versions on Ubuntu, the older version might still be active causing conflicts.

Example:


PHP 7.x is active but 8.x is installed.

Solution:


1. Use `update-alternatives` to set the default PHP version.
2. Restart the Apache or Nginx service.

Beginner's Guide to PHP