1

I have tried to upgrade my apache2.2 to apache2.4 and php5.3 to php5.5 on my Ubuntu 12.04. For php5.5 I have used those commands below (I dont remember which PPA i used for apache upgrade) :

add-apt-repository ppa:ondrej/php5
add-apt-repository ppa:ondrej/php5-oldstable
apt-get update
apt-get install php5
apt-get install python-software-properties

Than I tried to downgrade it by removing PPAs with :

sudo add-apt-repository --remove ppa:ondrej/php5-oldstable
sudo add-apt-repository --remove ppa:ondrej/php5
apt-get update
apt-get install php5

But it gave me this output with some errors :

The following packages have unmet dependencies:
 libapache2-mod-php5 : Depends: php5-common (= 5.5.26+dfsg-1+deb.sury.org~precise+1) but 5.3.10-1ubuntu3 is to be installed
 php5 : Depends: php5-common (>= 5.3.10-1ubuntu3.18) but 5.3.10-1ubuntu3 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

So once I issued the command 'apt-get -f install' I get this :

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages will be REMOVED:
  libapache2-mod-php5
0 upgraded, 0 newly installed, 1 to remove and 119 not upgraded.
1 not fully installed or removed.
After this operation, 9473 kB disk space will be freed.
Do you want to continue [Y/n]? y
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_PAPER = "tr_TR.UTF-8",
    LC_ADDRESS = "tr_TR.UTF-8",
    LC_MONETARY = "tr_TR.UTF-8",
    LC_NUMERIC = "tr_TR.UTF-8",
    LC_TELEPHONE = "tr_TR.UTF-8",
    LC_IDENTIFICATION = "tr_TR.UTF-8",
    LC_MEASUREMENT = "tr_TR.UTF-8",
    LC_TIME = "tr_TR.UTF-8",
    LC_NAME = "tr_TR.UTF-8",
    LANG = "en_GB.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_ALL to default locale: No such file or directory
Setting up php5-fpm (5.3.10-1ubuntu3) ...
start: Job failed to start
invoke-rc.d: initscript php5-fpm, action "start" failed.
dpkg: error processing php5-fpm (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 php5-fpm
E: Sub-process /usr/bin/dpkg returned an error code (1)

I have checked my sourcelists by commands below. They gave no output, so I thought those PPAs removed successfully.

cat /etc/apt/sources.list.d/*.list
cat /etc/apt/sources.list | grep php
cat /etc/apt/sources.list | grep apache

Also :

dpkg -l |grep php 

gave me this :

ii  dh-php5                          0.2+deb.sury.org~precise+1            debhelper add-on to handle PHP PECL extensions
ii  libapache2-mod-php5              5.5.26+dfsg-1+deb.sury.org~precise+1  server-side, HTML-embedded scripting language (Apache 2 module)
ii  php-pear                         5.3.10-1ubuntu3                       PEAR - PHP Extension and Application Repository
ii  php5                             5.3.10-1ubuntu3                       server-side, HTML-embedded scripting language (metapackage)
rc  php5-apcu                        4.0.6-1+deb.sury.org~precise+1        APC User Cache for PHP 5
ii  php5-cli                         5.3.10-1ubuntu3                       command-line interpreter for the php5 scripting language
ii  php5-common                      5.3.10-1ubuntu3                       Common files for packages built from the php5 source
iF  php5-fpm                         5.3.10-1ubuntu3                       server-side, HTML-embedded scripting language (FPM-CGI binary)
ii  php5-gd                          5.3.10-1ubuntu3                       GD module for php5
ii  php5-imagick                     3.1.0~rc1-1                           ImageMagick module for php5
rc  php5-json                        1.3.6-1+deb.sury.org~precise+1        JSON module for php5
ii  php5-mcrypt                      5.3.5-0ubuntu1                        MCrypt module for php5
ii  php5-mysql                       5.3.10-1ubuntu3                       MySQL module for php5
ii  phpmyadmin                       4:3.4.10.1-1                          MySQL web administration tool
ii  pkg-php-tools                    1.21+deb.sury.org~precise+1           various packaging tools and scripts for PHP packages

I have also tried to re-add PPAs and removed them with ppa-purge :

add-apt-repository ppa:ondrej/php5
add-apt-repository ppa:ondrej/php5-oldstable
ppa-purge ppa:ondrej/php5-oldstable
ppa-purge ppa:ondrej/php5

But after remove of PPAs, it gave this output with some errors :

ppa-purge ppa:ondrej/php5-oldstable

Updating packages lists
PPA to be removed: ondrej php5-oldstable
comm: file 2 is not in sorted order
Package revert list generated:
 dh-php5/precise libapache2-mod-php5/precise libbsd0/precise libedit2/precise 
php-pear/precise php5/precise php5-cli/precise php5-common/precise 
php5-fpm/precise php5-gd/precise php5-imagick/precise php5-mcrypt/precise 
php5-mysql/precise

Disabling ondrej PPA from 
/etc/apt/sources.list.d/ondrej-php5-oldstable-precise.list
Updating packages lists
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libedit2 is already the newest version.
libapache2-mod-php5 is already the newest version.
libbsd0 is already the newest version.
dh-php5 is already the newest version.
Selected version '0.2+deb.sury.org~precise+1' (PPA for PHP 5.5:12.04/precise [all]) for 'dh-php5'
Selected version '5.5.26+dfsg-1+deb.sury.org~precise+1' (PPA for PHP 5.5:12.04/precise [amd64]) for 'libapache2-mod-php5'
Selected version '0.7.0-2+deb.sury.org~precise+1' (PPA for PHP 5.5:12.04/precise [amd64]) for 'libbsd0'
Selected version '3.1-20140620-2+deb.sury.org~precise+4' (PPA for PHP 5.5:12.04/precise [amd64]) for 'libedit2'
Selected version '5.5.26+dfsg-1+deb.sury.org~precise+1' (PPA for PHP 5.5:12.04/precise [all]) for 'php-pear'
Selected version '5.5.26+dfsg-1+deb.sury.org~precise+1' (PPA for PHP 5.5:12.04/precise [all]) for 'php5'
Selected version '5.5.26+dfsg-1+deb.sury.org~precise+1' (PPA for PHP 5.5:12.04/precise [amd64]) for 'php5-cli'
Selected version '5.5.26+dfsg-1+deb.sury.org~precise+1' (PPA for PHP 5.5:12.04/precise [amd64]) for 'php5-common'
Selected version '2.15-0ubuntu10.12' (Ubuntu:12.04/precise-updates [amd64]) for 'libc6' because of 'php5-common'
Selected version '5.5.26+dfsg-1+deb.sury.org~precise+1' (PPA for PHP 5.5:12.04/precise [amd64]) for 'php5-fpm'
Selected version '5.5.26+dfsg-1+deb.sury.org~precise+1' (PPA for PHP 5.5:12.04/precise [amd64]) for 'php5-gd'
Selected version '3.1.2-1+deb.sury.org~precise+2' (PPA for PHP 5.5:12.04/precise [amd64]) for 'php5-imagick'
Selected version '5.5.26+dfsg-1+deb.sury.org~precise+1' (PPA for PHP 5.5:12.04/precise [amd64]) for 'php5-mcrypt'
Selected version '5.5.26+dfsg-1+deb.sury.org~precise+1' (PPA for PHP 5.5:12.04/precise [amd64]) for 'php5-mysql'
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 libapache2-mod-php5 : Depends: php5-json
 php5-cli : Depends: php5-json
            Recommends: php5-readline but it is not going to be installed
 php5-fpm : Depends: php5-json
 pkg-php-tools : Depends: php5-json
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
The following NEW packages will be installed:
  php5-json{a} php5-readline{a} 
The following packages will be REMOVED:
  libt1-5{u} 
The following packages will be upgraded:
  php-pear php5 php5-cli php5-common php5-fpm php5-gd php5-imagick php5-mcrypt php5-mysql 
9 packages upgraded, 2 newly installed, 1 to remove and 112 not upgraded.
Need to get 14.0 kB/6836 kB of archives. After unpacking 1293 kB will be used.
Do you want to continue? [Y/n/?] y
Get: 1 http://ppa.launchpad.net/ondrej/php5/ubuntu/ precise/main php5-readline amd64 5.5.26+dfsg-1+deb.sury.org~precise+1 [14.0 kB]
Fetched 14.0 kB in 0s (357 kB/s)        
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_PAPER = "tr_TR.UTF-8",
    LC_ADDRESS = "tr_TR.UTF-8",
    LC_MONETARY = "tr_TR.UTF-8",
    LC_NUMERIC = "tr_TR.UTF-8",
    LC_TELEPHONE = "tr_TR.UTF-8",
    LC_IDENTIFICATION = "tr_TR.UTF-8",
    LC_MEASUREMENT = "tr_TR.UTF-8",
    LC_TIME = "tr_TR.UTF-8",
    LC_NAME = "tr_TR.UTF-8",
    LANG = "en_GB.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_ALL to default locale: No such file or directory
(Reading database ... 38805 files and directories currently installed.)
Preparing to replace php5-mysql 5.3.10-1ubuntu3 (using .../php5-mysql_5.5.26+dfsg-1+deb.sury.org~precise+1_amd64.deb) ...
Unpacking replacement php5-mysql ...
Preparing to replace php5-gd 5.3.10-1ubuntu3 (using .../php5-gd_5.5.26+dfsg-1+deb.sury.org~precise+1_amd64.deb) ...
Unpacking replacement php5-gd ...
Preparing to replace php5-mcrypt 5.3.5-0ubuntu1 (using .../php5-mcrypt_5.5.26+dfsg-1+deb.sury.org~precise+1_amd64.deb) ...
Unpacking replacement php5-mcrypt ...
Preparing to replace php5-imagick 3.1.0~rc1-1 (using .../php5-imagick_3.1.2-1+deb.sury.org~precise+2_amd64.deb) ...
Unpacking replacement php5-imagick ...
Preparing to replace php5-cli 5.3.10-1ubuntu3 (using .../php5-cli_5.5.26+dfsg-1+deb.sury.org~precise+1_amd64.deb) ...
Unpacking replacement php5-cli ...
Preparing to replace php5-common 5.3.10-1ubuntu3 (using .../php5-common_5.5.26+dfsg-1+deb.sury.org~precise+1_amd64.deb) ...
Unpacking replacement php5-common ...
dpkg: warning: unable to delete old directory '/etc/php5/conf.d': Directory not empty
Selecting previously unselected package php5-json.
Unpacking php5-json (from .../php5-json_1.3.6-1+deb.sury.org~precise+1_amd64.deb) ...
Processing triggers for libapache2-mod-php5 ...
Processing triggers for man-db ...
locale: Cannot set LC_ALL to default locale: No such file or directory
(Reading database ... 38844 files and directories currently installed.)
Removing libt1-5 ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Selecting previously unselected package php5-readline.
(Reading database ... 38833 files and directories currently installed.)
Unpacking php5-readline (from .../php5-readline_5.5.26+dfsg-1+deb.sury.org~precise+1_amd64.deb) ...
Preparing to replace php-pear 5.3.10-1ubuntu3 (using .../php-pear_5.5.26+dfsg-1+deb.sury.org~precise+1_all.deb) ...
Unpacking replacement php-pear ...
Preparing to replace php5 5.3.10-1ubuntu3 (using .../php5_5.5.26+dfsg-1+deb.sury.org~precise+1_all.deb) ...
Unpacking replacement php5 ...
Processing triggers for libapache2-mod-php5 ...
Setting up php5-common (5.5.26+dfsg-1+deb.sury.org~precise+1) ...
Installing new version of config file /etc/cron.d/php5 ...
locale: Cannot set LC_ALL to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
dpkg: dependency problems prevent configuration of php5-fpm:
 php5-fpm depends on php5-common (= 5.3.10-1ubuntu3); however:
  Version of php5-common on system is 5.5.26+dfsg-1+deb.sury.org~precise+1.
dpkg: error processing php5-fpm (--configure):
 dependency problems - leaving unconfigured
Processing triggers for libapache2-mod-php5 ...
No apport report written because MaxReports is reached already
                                                              Setting up php5 (5.5.26+dfsg-1+deb.sury.org~precise+1) ...
Setting up php5-mysql (5.5.26+dfsg-1+deb.sury.org~precise+1) ...
locale: Cannot set LC_ALL to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
Setting up php5-gd (5.5.26+dfsg-1+deb.sury.org~precise+1) ...
locale: Cannot set LC_ALL to default locale: No such file or directory
Setting up php5-mcrypt (5.5.26+dfsg-1+deb.sury.org~precise+1) ...
locale: Cannot set LC_ALL to default locale: No such file or directory
Setting up php5-imagick (3.1.2-1+deb.sury.org~precise+2) ...
Setting up php5-json (1.3.6-1+deb.sury.org~precise+1) ...
php5_invoke: Enable module json for apache2 SAPI
Setting up php5-cli (5.5.26+dfsg-1+deb.sury.org~precise+1) ...
locale: Cannot set LC_ALL to default locale: No such file or directory
Replacing config file /etc/php5/cli/php.ini with new version
Setting up php5-readline (5.5.26+dfsg-1+deb.sury.org~precise+1) ...
locale: Cannot set LC_ALL to default locale: No such file or directory

Creating config file /etc/php5/mods-available/readline.ini with new version
php5_invoke: Enable module readline for apache2 SAPI
php5_invoke: Enable module readline for cli SAPI
Setting up php-pear (5.5.26+dfsg-1+deb.sury.org~precise+1) ...
Installing new version of config file /etc/pear/pear.conf ...
Processing triggers for libapache2-mod-php5 ...
Errors were encountered while processing:
 php5-fpm
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install.  Trying to recover:
dpkg: dependency problems prevent configuration of php5-fpm:
 php5-fpm depends on php5-common (= 5.3.10-1ubuntu3); however:
  Version of php5-common on system is 5.5.26+dfsg-1+deb.sury.org~precise+1.
dpkg: error processing php5-fpm (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 php5-fpm

Current status: 113 updates [-8].
Warning:  Something went wrong, packages may not have been reverted

And for the command "ppa-purge ppa:ondrej/php5" gave me this :

Updating packages lists
PPA to be removed: ondrej php5
comm: file 2 is not in sorted order
Package revert list generated:
 apache2/precise apache2-bin/precise apache2-data/precise apache2-utils/precise 
apache2.2-bin/precise apache2.2-common/precise dh-php5/precise 
libapache2-mod-php5/precise libapache2-mod-proxy-html/precise libapr1/precise 
libapr1-dev/precise libaprutil1/precise libaprutil1-dbd-sqlite3/precise 
libaprutil1-dev/precise libaprutil1-ldap/precise libbsd0/precise 
libedit2/precise libgd3/precise libjson-c2/precise php-pear/precise 
php5/precise php5-apcu/precise php5-cli/precise php5-common/precise 
php5-fpm/precise php5-gd/precise php5-imagick/precise php5-json/precise 
php5-mcrypt/precise php5-mysql/precise php5-readline/precise 
pkg-php-tools/precise

Disabling ondrej PPA from 
/etc/apt/sources.list.d/ondrej-php5-oldstable-precise.list
Disabling ondrej PPA from /etc/apt/sources.list.d/ondrej-php5-precise.list
Updating packages lists
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Release 'precise' for 'apache2-bin' was not found
E: Release 'precise' for 'apache2-data' was not found
E: Release 'precise' for 'dh-php5' was not found
E: Release 'precise' for 'libgd3' was not found
E: Release 'precise' for 'libjson-c2' was not found
E: Release 'precise' for 'php5-apcu' was not found
E: Release 'precise' for 'php5-json' was not found
E: Release 'precise' for 'php5-readline' was not found
Unable to find an archive "precise" for the package "apache2-bin"
Unable to find an archive "precise" for the package "apache2-data"
Unable to find an archive "precise" for the package "dh-php5"
Unable to find an archive "precise" for the package "libgd3"
Unable to find an archive "precise" for the package "libjson-c2"
Unable to find an archive "precise" for the package "php5-apcu"
Unable to find an archive "precise" for the package "php5-json"
Unable to find an archive "precise" for the package "php5-readline"
Unable to find an archive "precise" for the package "apache2-bin"
Unable to find an archive "precise" for the package "apache2-data"
Unable to find an archive "precise" for the package "dh-php5"
Unable to find an archive "precise" for the package "libgd3"
Unable to find an archive "precise" for the package "libjson-c2"
Unable to find an archive "precise" for the package "php5-apcu"
Unable to find an archive "precise" for the package "php5-json"
Unable to find an archive "precise" for the package "php5-readline"
The following packages will be DOWNGRADED:
  apache2{b} apache2-utils apache2.2-bin libapache2-mod-php5 libapache2-mod-proxy-html libapr1 libapr1-dev 
  libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-dev libaprutil1-ldap libbsd0 libedit2 php-pear php5 php5-cli 
  php5-common php5-gd php5-imagick php5-mcrypt php5-mysql pkg-php-tools 
The following NEW packages will be installed:
  apache2-mpm-prefork{ab} apache2.2-common libt1-5{a} php5-dev{ab} 
The following packages will be REMOVED:
  libonig2{u} libqdbm14{u} php5-json{u} php5-readline{u} 
The following partially installed packages will be configured:
  php5-fpm 
0 packages upgraded, 4 newly installed, 22 downgraded, 4 to remove and 112 not upgraded.
Need to get 3748 kB/11.4 MB of archives. After unpacking 4451 kB will be used.
The following packages have unmet dependencies:
 dh-php5 : Conflicts: php5-dev (< 5.5.9+dfsg-2~) but 5.3.10-1ubuntu3.18 is to be installed.
 apache2-mpm-prefork : Depends: apache2.2-common (= 2.2.22-1ubuntu1.9) but 2.2.22-1ubuntu1 is to be installed.
                       Depends: apache2.2-bin (= 2.2.22-1ubuntu1.9) but 2.2.22-1ubuntu1 is to be installed.
 apache2 : Depends: apache2-mpm-worker (= 2.2.22-1ubuntu1) but it is not going to be installed. or
                    apache2-mpm-prefork (= 2.2.22-1ubuntu1) but 2.2.22-1ubuntu1.9 is to be installed. or
                    apache2-mpm-event (= 2.2.22-1ubuntu1) but it is not going to be installed. or
                    apache2-mpm-itk (= 2.2.22-1ubuntu1) but it is not going to be installed.
 apache2-bin : Depends: libapr1 (>= 1.5.0) but 1.4.6-1 is to be installed.
               Depends: libaprutil1 (>= 1.5.0) but 1.3.12+dfsg-3 is to be installed.
               Conflicts: apache2.2-bin (< 2.3~) but 2.2.22-1ubuntu1 is to be installed.
               Conflicts: apache2.2-common (< 2.3~) but 2.2.22-1ubuntu1 is to be installed.
               Breaks: libapache2-mod-proxy-html (< 1:2.4.4-2~) but 3.0.1-1 is to be installed.
 apache2-data : Conflicts: apache2.2-common (< 2.3~) but 2.2.22-1ubuntu1 is to be installed.
 php5-dev : Depends: php5-common (>= 5.3.10-1ubuntu3.18) but 5.3.10-1ubuntu3 is to be installed.
The following actions will resolve these dependencies:

     Remove the following packages:                       
1)     apache2                                            
2)     apache2-bin                                        
3)     libapache2-mod-php5                                
4)     libapache2-mod-proxy-html                          

     Keep the following packages at their current version:
5)     apache2-mpm-prefork [Not Installed]                
6)     apache2.2-common [Not Installed]                   
7)     php5-dev [Not Installed]                           

     Leave the following dependencies unresolved:         
8)     php-pear recommends php5-dev                       
9)     phpmyadmin recommends apache2 | lighttpd | httpd   


Accept this solution? [Y/n/q/?] y
The following packages will be DOWNGRADED:
  apache2-utils apache2.2-bin libapr1 libapr1-dev libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-dev 
  libaprutil1-ldap libbsd0 libedit2 php-pear php5 php5-cli php5-common php5-gd php5-imagick php5-mcrypt php5-mysql 
  pkg-php-tools 
The following NEW packages will be installed:
  libt1-5{a} 
The following packages will be REMOVED:
  apache2{a} apache2-bin{a} libapache2-mod-php5{a} libapache2-mod-proxy-html{a} php5-json{u} php5-readline{u} 
The following partially installed packages will be configured:
  php5-fpm 
The following packages are RECOMMENDED but will NOT be installed:
  php5-dev 
0 packages upgraded, 1 newly installed, 19 downgraded, 6 to remove and 112 not upgraded.
Need to get 158 kB/7576 kB of archives. After unpacking 10.7 MB will be freed.
Do you want to continue? [Y/n/?] y
Get: 1 http://ubuntu.mirrors.ovh.net/ftp.ubuntu.com/ubuntu/ precise/main libt1-5 amd64 5.1.2-3.4ubuntu1 [158 kB]
Fetched 158 kB in 0s (3189 kB/s)
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_PAPER = "tr_TR.UTF-8",
    LC_ADDRESS = "tr_TR.UTF-8",
    LC_MONETARY = "tr_TR.UTF-8",
    LC_NUMERIC = "tr_TR.UTF-8",
    LC_TELEPHONE = "tr_TR.UTF-8",
    LC_IDENTIFICATION = "tr_TR.UTF-8",
    LC_MEASUREMENT = "tr_TR.UTF-8",
    LC_TIME = "tr_TR.UTF-8",
    LC_NAME = "tr_TR.UTF-8",
    LANG = "en_GB.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_ALL to default locale: No such file or directory
(Reading database ... 38843 files and directories currently installed.)
Removing php5-readline ...
php5_invoke prerm: Disable module readline for apache2 SAPI
php5_invoke prerm: Disable module readline for cli SAPI
Processing triggers for libapache2-mod-php5 ...
dpkg: warning: downgrading php5-cli from 5.5.26+dfsg-1+deb.sury.org~precise+1 to 5.3.10-1ubuntu3.
(Reading database ... 38836 files and directories currently installed.)
Preparing to replace php5-cli 5.5.26+dfsg-1+deb.sury.org~precise+1 (using .../php5-cli_5.3.10-1ubuntu3_amd64.deb) ...
Unpacking replacement php5-cli ...
dpkg: warning: downgrading php5-mysql from 5.5.26+dfsg-1+deb.sury.org~precise+1 to 5.3.10-1ubuntu3.
Preparing to replace php5-mysql 5.5.26+dfsg-1+deb.sury.org~precise+1 (using .../php5-mysql_5.3.10-1ubuntu3_amd64.deb) ...
Unpacking replacement php5-mysql ...
Processing triggers for man-db ...
locale: Cannot set LC_ALL to default locale: No such file or directory
Processing triggers for libapache2-mod-php5 ...
dpkg: php5-json: dependency problems, but removing anyway as you requested:
 libapache2-mod-php5 depends on php5-json; however:
  Package php5-json is to be removed.
 pkg-php-tools depends on php5-json; however:
  Package php5-json is to be removed.
(Reading database ... 38827 files and directories currently installed.)
Removing php5-json ...
php5_invoke prerm: Disable module json for apache2 SAPI
dpkg: warning: downgrading php5-common from 5.5.26+dfsg-1+deb.sury.org~precise+1 to 5.3.10-1ubuntu3.
(Reading database ... 38820 files and directories currently installed.)
Preparing to replace php5-common 5.5.26+dfsg-1+deb.sury.org~precise+1 (using .../php5-common_5.3.10-1ubuntu3_amd64.deb) ...
Unpacking replacement php5-common ...
dpkg: warning: unable to delete old directory '/var/lib/php5/modules': Directory not empty
Processing triggers for libapache2-mod-php5 ...
Setting up php5-common (5.3.10-1ubuntu3) ...
Installing new version of config file /etc/cron.d/php5 ...
Setting up php5-fpm (5.3.10-1ubuntu3) ...
start: Job failed to start
invoke-rc.d: initscript php5-fpm, action "start" failed.
dpkg: error processing php5-fpm (--configure):
 subprocess installed post-installation script returned error exit status 1
No apport report written because MaxReports is reached already
                                                              Errors were encountered while processing:
 php5-fpm
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install.  Trying to recover:
Setting up php5-fpm (5.3.10-1ubuntu3) ...
start: Job failed to start
invoke-rc.d: initscript php5-fpm, action "start" failed.
dpkg: error processing php5-fpm (--configure):
 subprocess installed post-installation script returned error exit status 1
Setting up php5-cli (5.3.10-1ubuntu3) ...
locale: Cannot set LC_ALL to default locale: No such file or directory
Replacing config file /etc/php5/cli/php.ini with new version
Setting up php5-mysql (5.3.10-1ubuntu3) ...
Errors were encountered while processing:
 php5-fpm

Current status: 6 broken [+5], 113 updates [+1], 64746 new [-2].
Warning:  Something went wrong, packages may not have been reverted

After re-adding and removing PPAs with ppa-purge. I had different output from "apt-get install php5" This time i didnt get anything from php5.5 but problem about php5-imagick :

The following packages have unmet dependencies:
 php5 : Depends: libapache2-mod-php5 (>= 5.3.10-1ubuntu3.18) but it is not going to be installed or
                 libapache2-mod-php5filter (>= 5.3.10-1ubuntu3.18) but it is not going to be installed or
                 php5-cgi (>= 5.3.10-1ubuntu3.18) but it is not going to be installed or
                 php5-fpm (>= 5.3.10-1ubuntu3.18) but 5.3.10-1ubuntu3 is to be installed
        Depends: php5-common (>= 5.3.10-1ubuntu3.18) but 5.3.10-1ubuntu3 is to be installed
 php5-imagick : Depends: phpapi-20121212 but it is not installable
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

Than again : "apt-get -f install", and got this :

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages will be REMOVED:
  php5-imagick
0 upgraded, 0 newly installed, 1 to remove and 118 not upgraded.
2 not fully installed or removed.
After this operation, 554 kB disk space will be freed.
Do you want to continue [Y/n]? y
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_PAPER = "tr_TR.UTF-8",
    LC_ADDRESS = "tr_TR.UTF-8",
    LC_MONETARY = "tr_TR.UTF-8",
    LC_NUMERIC = "tr_TR.UTF-8",
    LC_TELEPHONE = "tr_TR.UTF-8",
    LC_IDENTIFICATION = "tr_TR.UTF-8",
    LC_MEASUREMENT = "tr_TR.UTF-8",
    LC_TIME = "tr_TR.UTF-8",
    LC_NAME = "tr_TR.UTF-8",
    LANG = "en_GB.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_ALL to default locale: No such file or directory
(Reading database ... 37595 files and directories currently installed.)
Removing php5-imagick ...
/var/lib/dpkg/info/php5-imagick.prerm: line 13: php5dismod: command not found
dpkg: error processing php5-imagick (--remove):
 subprocess installed pre-removal script returned error exit status 127
/var/lib/dpkg/info/php5-imagick.postinst: line 11: php5enmod: command not found
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 127
Errors were encountered while processing:
 php5-imagick
E: Sub-process /usr/bin/dpkg returned an error code (1)

1 Answers1

0

I'd start by getting a solid PHP 5.5 system:

sudo add-apt-repository ppa:ondrej/php5
sudo add-apt-repository ppa:ondrej/php5-oldstable
sudo apt-get update
sudo apt-get -f install

Remove all the things but pay attention to what's being removed:

sudo apt-get -s remove ^php.* dh-php5 libapache2-mod-php5

Remove the PPAs:

sudo add-apt-repository --remove ppa:ondrej/php5-oldstable
sudo add-apt-repository --remove ppa:ondrej/php5
sudo apt-get update

Reinstall the LAMP stack:

sudo apt-get install lamp-server^

Right, you seem to be in a bit of a pickle regarding php5dismod and php5enmod not existing. They're probably part of the newer PHP, but given the mixed state you're in, not available on your system.

I'm trying to think of the least destructive way to fix this, I think we could just dolly the commands so it can execute something and carry on.

sudo install -b -m 755 /dev/stdin /usr/sbin/php5enmod << EOF
#!/bin/bash
echo "Fake command run: \$0"
EOF
sudo cp /usr/sbin/php5{en,dis}mod

Then run your fix, then delete the fake files with:

sudo rm /usr/sbin/php5{en,dis}mod

You might have to do this earlier, or later (they may block PHP5.5 being installed).
It'll be fun to find out.

nixpower
  • 1,210
  • 6
  • 18
Oli
  • 293,335
  • Once I issue the comman : "sudo apt-get install -f" I get errors about image-magic : /var/lib/dpkg/info/php5-imagick.prerm: line 13: php5dismod: command not found dpkg: error processing php5-imagick (--remove): subprocess installed pre-removal script returned error exit status 127 /var/lib/dpkg/info/php5-imagick.postinst: line 11: php5enmod: command not found dpkg: error while cleaning up: subprocess installed post-installation script returned error exit status 127 Errors were encountered while processing: php5-imagick – grace ancestor Jun 29 '15 at 12:24
  • @graceancestor It seems the uninstall script is trying to use php5dismod to disable mods before removing them. php5dismod was not available in 12.04, and it was added in 13.10. I'm not sure how to fix it, but if this info is of any help, maybe someone else knows how to fix it. – Dan Jun 29 '15 at 12:36
  • I changed the apt-get install -f to the corrected: apt-get -f install – nixpower Jun 29 '15 at 14:32