You are here

Debian Jessie update banjaxes PHP5

Upgraded this server today, and BANG there goes Drupal, showing off all its source code like the filthy cad that it is. It's my own fault really, running a CMS that is written in PHP; I'm just too lazy at the moment to face evaluating a replacement.

<?php

/**
 * @file
 * The PHP page that serves all page requests on a Drupal installation.
 *
 * The routines here dispatch control to the appropriate handler, which then
 * prints the appropriate page.
 *
 * All Drupal code is released under the GNU General Public License.
 * See COPYRIGHT.txt and LICENSE.txt.
 */

/**
 * Root directory of Drupal installation.
 */
define('DRUPAL_ROOT', getcwd());

require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
menu_execute_active_handler();

PHP is usually a pig to upgrade on Debian - it never goes smoothly - so I sighed and started Googling for the solution. The nearest I came was this StackOverflow question about PHP on Apache returning source instead of running it, but sadly that wasn't the issue. No amount of twiddling php.ini settings helped.

Eventually I read this StackOverflow question, and decided that maybe nuking the site from orbit was the answer. On running the first command, purging libapache2-mod-php5's config files, apt sprang into action and got rid of libapache2-mod-php5 altogether:

racky:/var/www/drupal# apt-get purge libapache2-mod-php5
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libapache2-mod-php5filter
The following packages will be REMOVED:
  libapache2-mod-php5*
The following NEW packages will be installed:
  libapache2-mod-php5filter
0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
Need to get 2,208 kB of archives.
After this operation, 5,120 B disk space will be freed.
Do you want to continue? [Y/n] 
Get:1 http://security.debian.org/ jessie/updates/main libapache2-mod-php5filter amd64 5.6.22+dfsg-0+deb8u1 [2,208 kB]
Fetched 2,208 kB in 0s (4,368 kB/s)                 
dpkg: libapache2-mod-php5: dependency problems, but removing anyway as you requested:
 php5 depends on libapache2-mod-php5 (>= 5.6.22+dfsg-0+deb8u1~) | libapache2-mod-php5filter (>= 5.6.22+dfsg-0+deb8u1~) | php5-cgi (>= 5.6.22+dfsg-0+deb8u1~) | php5-fpm (>= 5.6.22+dfsg-0+deb8u1~); however:
  Package libapache2-mod-php5 is to be removed.
  Package libapache2-mod-php5filter is not installed.
  Package php5-cgi is not installed.
  Package php5-fpm is not installed.

(Reading database ... 44603 files and directories currently installed.)
Removing libapache2-mod-php5 (5.6.22+dfsg-0+deb8u1) ...
php5_invoke prerm: Disable module pgsql for apache2 SAPI
php5_invoke prerm: Disable module pdo for apache2 SAPI
php5_invoke prerm: Disable module json for apache2 SAPI
php5_invoke prerm: Disable module gmp for apache2 SAPI
php5_invoke prerm: Disable module recode for apache2 SAPI
php5_invoke prerm: Disable module gd for apache2 SAPI
php5_invoke prerm: Disable module readline for apache2 SAPI
php5_invoke prerm: Disable module pdo_pgsql for apache2 SAPI
php5_invoke prerm: Disable module opcache for apache2 SAPI
Module php5 disabled.
apache2_invoke prerm: Disable module php5
apache2_reload: Your configuration is broken. Not restarting Apache 2
apache2_reload: AH00526: Syntax error on line 56 of /etc/apache2/sites-enabled/001-teched-creations.com.conf:
apache2_reload: Invalid command 'php_admin_value', perhaps misspelled or defined by a module not included in the server configuration
Purging configuration files for libapache2-mod-php5 (5.6.22+dfsg-0+deb8u1) ...
apache2_invoke postrm: Purging state for php5
dpkg: warning: while removing libapache2-mod-php5, directory '/etc/php5/apache2/conf.d' not empty so not removed
Selecting previously unselected package libapache2-mod-php5filter.
(Reading database ... 44597 files and directories currently installed.)
Preparing to unpack .../libapache2-mod-php5filter_5.6.22+dfsg-0+deb8u1_amd64.deb ...
Unpacking libapache2-mod-php5filter (5.6.22+dfsg-0+deb8u1) ...
Setting up libapache2-mod-php5filter (5.6.22+dfsg-0+deb8u1) ...

Creating config file /etc/php5/apache2filter/php.ini with new version
php5_invoke: Enable module pgsql for apache2filter SAPI
php5_invoke: Enable module pdo for apache2filter SAPI
php5_invoke: Enable module json for apache2filter SAPI
php5_invoke: Enable module gmp for apache2filter SAPI
php5_invoke: Enable module recode for apache2filter SAPI
php5_invoke: Enable module gd for apache2filter SAPI
php5_invoke: Enable module readline for apache2filter SAPI
php5_invoke: Enable module pdo_pgsql for apache2filter SAPI
php5_invoke: Enable module opcache for apache2filter SAPI
/var/lib/dpkg/info/libapache2-mod-php5filter.postinst: 291: [: !=: unexpected operator
apache2_switch_mpm prefork: No action required
apache2_invoke: Enable module php5filter
Restarting web server: apache2.
racky:/var/www/drupal# apt-get remove libapache2-mod-php5
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package 'libapache2-mod-php5' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Quick restart of Apache and problem solvered!