Resolving Dependency Conflicts After Ubuntu 18.04 Upgrade
When you run do-release-upgrade -d to move from 16.04 to 18.04, the upgrade process is aggressive. It identifies packages that are deprecated in the new release and flags them for removal. In your specific case, the system flagged php7.2-curl alongside other legacy components like php-imagick. While imagick and certbot reinstalled cleanly from the standard repositories, php7.2-curl refused to install, throwing a dependency error regarding version mismatches between the main PHP package and a specific module.
The core issue lies in the error message: Depends: php7.2-common (= 7.2.3-1ubuntu1) but 7.2.4-1+ubuntu16.04.1+deb.sury.org+1 is to be installed. This indicates a conflict between two package sources. The standard Ubuntu 18.04 repositories provide php7.2-common at version 7.2.3-1ubuntu1, but your system currently has a newer version, 7.2.4-1..., installed from the Sury.org repository. This third-party source provides backports and PECL extensions that Ubuntu's official team hasn't yet packaged or approved for inclusion in their standard archives.
When you attempt to install php7.2-curl via apt, it attempts to resolve dependencies using only the currently trusted sources. However, because the installed version of php7.2-common does not match what the package manager expects for a fresh installation or update within that specific repository context, it flags the state as "broken." The package manager cannot reconcile the version difference between the official Ubuntu pool and the Sury.org backports without explicit user intervention to either force an upgrade of the base packages or pinning specific sources.
To fix this, you must align the versions across your repositories. Since you are already running a newer php7.2-common from Sury, you should not revert to the older Ubuntu version unless necessary. Instead, ensure that the package lists from both sources are updated and then force an upgrade of the common modules to match the backport versions. Run the following commands to update your package lists and attempt to resolve the dependencies:
sudo add-apt-repository ppa:sury.org/php
sudo apt update
sudo apt install --fix-broken php7.2-common php7.2-curl
The --fix-broken flag instructs APT to adjust the dependency graph to accommodate existing installed packages that conflict with the default state. If this still fails, you may need to explicitly hold back the Ubuntu version of the package or remove it entirely if the Sury version is fully compatible. However, a more robust long-term solution involves managing your PHP stack via the official Ondrej's PPA (ppa:ondrej/php), which often supersedes both Ubuntu and Sury packages for specific versions like 7.2.
If you require php-curl specifically for a Laravel application or another modern PHP framework, relying on split repositories like Sury can introduce fragility during future upgrades. The best practice is to consolidate your PHP sources to a single, well-maintained PPA that manages both the core interpreter and extensions consistently. This avoids the scenario where a system upgrade leaves you with a mismatched php-cli, php-fpm, or php-common set, rendering extensions uninstiable until you manually resolve version constraints.
Always verify your PHP installation after resolving these conflicts using:
php -m | grep curl
php -v
Ensure that the output reflects the expected extension loading without warnings about missing shared objects. If the extension still fails to load despite being installed, check the php.ini file located in /etc/php/7.2/mods-available/ to ensure the extension=curl.so line is uncommented and matches the architecture of your system binaries.