Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

tayyabshahzad1's avatar

Getting error on dedicated server

Hi, I am on my digital ocean account, When I want to install update or remove any package I get an error

You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 apache2 : Depends: apache2-utils (= 2.4.29-1ubuntu4.25) but it is not going to be installed
           Depends: apache2-data (= 2.4.29-1ubuntu4.25) but it is not going to be installed
 php7.4-cli : Depends: php7.4-common (= 7.4.24-1+ubuntu18.04.1+deb.sury.org+1) but 1:7.4.30-5+ubuntu18.04.1+deb.sury.org+1 is to be installed
 php7.4-dev : Depends: php7.4-common (= 7.4.24-1+ubuntu18.04.1+deb.sury.org+1) but 1:7.4.30-5+ubuntu18.04.1+deb.sury.org+1 is to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

Even when i run apt --fix-broken install then

dpkg: error processing archive /var/cache/apt/archives/php7.4-cli_1%3a7.4.30-5+ubuntu18.04.1+deb.sury.org+1_amd64.deb (--unpack):
 unable to create '/usr/bin/phar7.4.phar.dpkg-new' (while processing './usr/bin/phar7.4.phar'): Operation not permitted
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Preparing to unpack .../php7.4-dev_1%3a7.4.30-5+ubuntu18.04.1+deb.sury.org+1_amd64.deb ...
Unpacking php7.4-dev (1:7.4.30-5+ubuntu18.04.1+deb.sury.org+1) over (7.4.24-1+ubuntu18.04.1+deb.sury.org+1) ...
dpkg: error processing archive /var/cache/apt/archives/php7.4-dev_1%3a7.4.30-5+ubuntu18.04.1+deb.sury.org+1_amd64.deb (--unpack):
 unable to create '/usr/bin/php-config7.4.dpkg-new' (while processing './usr/bin/php-config7.4'): Operation not permitted
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/php7.4-cli_1%3a7.4.30-5+ubuntu18.04.1+deb.sury.org+1_amd64.deb
 /var/cache/apt/archives/php7.4-dev_1%3a7.4.30-5+ubuntu18.04.1+deb.sury.org+1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

0 likes
18 replies
tayyabshahzad1's avatar

@Tray2 Sir thanks for your reply I try https://www.digitalocean.com/community/tutorials/how-to-install-the-apache-web-server-on-ubuntu-20-04 But when I install any package.

The following packages have unmet dependencies:
 php-apcu : Depends: php8.1-apcu but it is not going to be installed
 php7.2-opcache : Depends: php7.2-common (= 7.2.34-33+ubuntu18.04.1+deb.sury.org+1) but 7.2.34-24+ubuntu18.04.1+deb.sury.org+1 is to be installed
 php7.4-cli : Depends: php7.4-common (= 7.4.24-1+ubuntu18.04.1+deb.sury.org+1) but 1:7.4.30-5+ubuntu18.04.1+deb.sury.org+1 is to be installed
 php7.4-dev : Depends: php7.4-common (= 7.4.24-1+ubuntu18.04.1+deb.sury.org+1) but 1:7.4.30-5+ubuntu18.04.1+deb.sury.org+1 is to be installed

tayyabshahzad1's avatar

@Sinnbeck Sir your old profile photo is the best the black & white, In this photo little bit difficult to recognize :)

Sinnbeck's avatar

@tayyabshahzad1 Are you running php7.4 or 8.1? It seems you have both. php comes with apache2 so this might be the issue. I would probably uninstall php7.4 and either reinstall it if thats what you use, or php8.1 if that what you use

tayyabshahzad1's avatar

@Sinnbeck Currently I am on php 7.4 and if i upgrade my PHP to 8.0 then again the above error comes and PHP 8 is not installed yet

tayyabshahzad1's avatar

@Sinnbeck I just run sudo apt install php8.1 The Error

Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 php7.4-cli : Depends: php7.4-common (= 7.4.24-1+ubuntu18.04.1+deb.sury.org+1) but 1:7.4.30-5+ubuntu18.04.1+deb.sury.org+1 is to be installed
 php7.4-dev : Depends: php7.4-common (= 7.4.24-1+ubuntu18.04.1+deb.sury.org+1) but 1:7.4.30-5+ubuntu18.04.1+deb.sury.org+1 is to be installed
 php8.1 : Depends: libapache2-mod-php8.1 but it is not going to be installed or
                   php8.1-fpm but it is not going to be installed or
                   php8.1-cgi but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).


Sinnbeck's avatar

@tayyabshahzad1 Yeah uninstall php7.4 first if you dont need it. But be sure to make a backup of any virtual host files you have in /etc/apache2/sites-available or /etc/apache2/sites-enabled

sudo apt purge php7.4-common
sudo apt install php8.1-common
tayyabshahzad1's avatar

@Sinnbeck no sir on first command getting error

Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 libapache2-mod-php7.4 : Depends: php7.4-common (= 1:7.4.30-5+ubuntu18.04.1+deb.sury.org+1) but it is not going to be installed
                         Recommends: apache2 but it is not going to be installed
 php7.4 : Depends: php7.4-common but it is not going to be installed
 php7.4-cli : Depends: php7.4-common (= 7.4.24-1+ubuntu18.04.1+deb.sury.org+1) but it is not going to be installed
 php7.4-curl : Depends: php7.4-common (= 1:7.4.30-5+ubuntu18.04.1+deb.sury.org+1) but it is not going to be installed
 php7.4-dev : Depends: php7.4-common (= 7.4.24-1+ubuntu18.04.1+deb.sury.org+1) but it is not going to be installed
 php7.4-gd : Depends: php7.4-common (= 1:7.4.30-5+ubuntu18.04.1+deb.sury.org+1) but it is not going to be installed
 php7.4-imagick : Depends: php7.4-common but it is not going to be installed
 php7.4-imap : Depends: php7.4-common (= 1:7.4.30-5+ubuntu18.04.1+deb.sury.org+1) but it is not going to be installed
 php7.4-intl : Depends: php7.4-common (= 1:7.4.30-5+ubuntu18.04.1+deb.sury.org+1) but it is not going to be installed
 php7.4-json : Depends: php7.4-common (= 1:7.4.30-5+ubuntu18.04.1+deb.sury.org+1) but it is not going to be installed
 php7.4-mbstring : Depends: php7.4-common (= 1:7.4.30-5+ubuntu18.04.1+deb.sury.org+1) but it is not going to be installed
 php7.4-mysql : Depends: php7.4-common (= 1:7.4.30-5+ubuntu18.04.1+deb.sury.org+1) but it is not going to be installed
 php7.4-opcache : Depends: php7.4-common (= 1:7.4.30-5+ubuntu18.04.1+deb.sury.org+1) but it is not going to be installed
 php7.4-readline : Depends: php7.4-common (= 1:7.4.30-5+ubuntu18.04.1+deb.sury.org+1) but it is not going to be installed
 php7.4-soap : Depends: php7.4-common (= 1:7.4.30-5+ubuntu18.04.1+deb.sury.org+1) but it is not going to be installed
 php7.4-xml : Depends: php7.4-common (= 1:7.4.30-5+ubuntu18.04.1+deb.sury.org+1) but it is not going to be installed
 php7.4-xmlrpc : Depends: php7.4-common (= 1:7.4.30-5+ubuntu18.04.1+deb.sury.org+1) but it is not going to be installed
 php7.4-zip : Depends: php7.4-common (= 1:7.4.30-5+ubuntu18.04.1+deb.sury.org+1) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).


Sinnbeck's avatar

@tayyabshahzad1 Can you try

sudo apt purge apache2 php7.4 php7.4-common  php7.4-cli php7.4-curl php7.4-imagick php7.4-gd php7.4-dev php7.4-intl php7.4-json php7.4-mbstring php7.4-mysql php7.4-opcache php7.4-readline php7.4-soap php7.4-xml php7.4-xmlrpc php7.4-zip
tayyabshahzad1's avatar

@Sinnbeck heheh no sir error is different

libapache2-mod-php7.4 : Depends: php7.4-cli but it is not going to be installed
                         Depends: php7.4-json but it is not going to be installed
                         Depends: php7.4-opcache but it is not going to be installed
                         Recommends: apache2 but it is not going to be installed

Please or to participate in this conversation.