[Solved] Install Scripts Need PHP5 and Fail Despite Multiple PHP Versions Installed and PHP5 Default

4 posts / 0 new
Last post
#1 Mon, 05/29/2017 - 19:32
jabowery

[Solved] Install Scripts Need PHP5 and Fail Despite Multiple PHP Versions Installed and PHP5 Default

The problem was that the line at /usr/share/webmin/virtual-server/php-lib.pl:34:

local ($dir) = grep { $_->{'words'}->[0] eq $pdir ||
      $_->{'words'}->[0] eq $pdir."/" }
    &apache::find_directive_struct("Directory", $vconf);

Directories of the form /home/*/public_html don't match. I replaced the asterisk with the virtual server name and things worked again.

Moreover, at line 54, there is: return 'mod_php'; Which executes if there is no match in the virtual server's directives above -- which explains how I could be getting a "mod_php" when apachctl reported no php modules at all.

------ The original question follows ----- Installed multiple versions of PHP with the packages.sury.org/php/ repository.

# php
php         php5.6      php5dismod  php5-fpm    php7.0      php-cgi     phpdismod   phpquery   
php5        php5-cgi    php5enmod   php5query   php7.1      php-cgi7.0  phpenmod   
# php -v
PHP 5.6.30-0+deb8u1 (cli) (built: Feb  8 2017 08:50:21)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
# update-alternatives --set php /usr/bin/php5

However, Virtualmin -> Install Scripts -> Wordpress still reports

This script cannot be installed, as it requires PHP version 5.

And Virtualmin -> Server Configuration -> PHP Versions reports:

This virtual server is using the mod_php execution mode for PHP, such does not allow per-directory version selection.

I installed the php repo that supports multiple versions with:

#!/bin/bash
# To add this repository please do:

if [ "$(whoami)" != "root" ]; then
    SUDO=sudo
fi

${SUDO} apt-get install apt-transport-https lsb-release ca-certificates
${SUDO} wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
${SUDO} sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
${SUDO} apt-get update

The installed php packages:

# apt list --installed |egrep 'php(5|7)'

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

libapache2-mod-php5/now 5.6.30+dfsg-0+deb8u1 amd64 [installed,local]
libapache2-mod-php5.6/unknown,now 5.6.30-11+0~20170522123046.34+stretch~1.gbp3d9cea amd64 [installed,automatic]
libapache2-mod-php7.0/unknown,now 7.0.19-1+0~20170522122642.31+stretch~1.gbpfcdab8 amd64 [installed,automatic]
libapache2-mod-php7.1/unknown,now 7.1.5-1+0~20170513113444.24+stretch~1.gbpe4bc94 amd64 [installed,automatic]
php5-cgi/now 5.6.30+dfsg-0+deb8u1 amd64 [installed,local]
php5-cli/now 5.6.30+dfsg-0+deb8u1 amd64 [installed,local]
php5-common/now 5.6.30+dfsg-0+deb8u1 amd64 [installed,local]
php5-fpm/now 5.6.30+dfsg-0+deb8u1 amd64 [installed,local]
php5-gd/now 5.6.30+dfsg-0+deb8u1 amd64 [installed,local]
php5-json/now 1.3.6-1 amd64 [installed,local]
php5-mcrypt/now 5.6.30+dfsg-0+deb8u1 amd64 [installed,local]
php5-mysqlnd/now 5.6.30+dfsg-0+deb8u1 amd64 [installed,local]
php5-mysqlnd-ms/now 1.6.0-1+b1 amd64 [installed,local]
php5-readline/now 5.6.30+dfsg-0+deb8u1 amd64 [installed,local]
php5.6/unknown,unknown,now 5.6.30-11+0~20170522123046.34+stretch~1.gbp3d9cea all [installed]
php5.6-cli/unknown,now 5.6.30-11+0~20170522123046.34+stretch~1.gbp3d9cea amd64 [installed,automatic]
php5.6-common/unknown,now 5.6.30-11+0~20170522123046.34+stretch~1.gbp3d9cea amd64 [installed,automatic]
php5.6-json/unknown,now 5.6.30-11+0~20170522123046.34+stretch~1.gbp3d9cea amd64 [installed,automatic]
php5.6-opcache/unknown,now 5.6.30-11+0~20170522123046.34+stretch~1.gbp3d9cea amd64 [installed,automatic]
php5.6-readline/unknown,now 5.6.30-11+0~20170522123046.34+stretch~1.gbp3d9cea amd64 [installed,automatic]
php7.0/unknown,unknown,now 7.0.19-1+0~20170522122642.31+stretch~1.gbpfcdab8 all [installed]
php7.0-bz2/unknown,now 7.0.19-1+0~20170522122642.31+stretch~1.gbpfcdab8 amd64 [installed,automatic]
php7.0-cgi/unknown,now 7.0.19-1+0~20170522122642.31+stretch~1.gbpfcdab8 amd64 [installed]
php7.0-cli/unknown,now 7.0.19-1+0~20170522122642.31+stretch~1.gbpfcdab8 amd64 [installed]
php7.0-common/unknown,now 7.0.19-1+0~20170522122642.31+stretch~1.gbpfcdab8 amd64 [installed,automatic]
php7.0-curl/unknown,now 7.0.19-1+0~20170522122642.31+stretch~1.gbpfcdab8 amd64 [installed]
php7.0-gd/unknown,now 7.0.19-1+0~20170522122642.31+stretch~1.gbpfcdab8 amd64 [installed]
php7.0-imap/unknown,now 7.0.19-1+0~20170522122642.31+stretch~1.gbpfcdab8 amd64 [installed]
php7.0-intl/unknown,now 7.0.19-1+0~20170522122642.31+stretch~1.gbpfcdab8 amd64 [installed]
php7.0-json/unknown,now 7.0.19-1+0~20170522122642.31+stretch~1.gbpfcdab8 amd64 [installed,automatic]
php7.0-mbstring/unknown,now 7.0.19-1+0~20170522122642.31+stretch~1.gbpfcdab8 amd64 [installed]
php7.0-mcrypt/unknown,now 7.0.19-1+0~20170522122642.31+stretch~1.gbpfcdab8 amd64 [installed]
php7.0-mysql/unknown,now 7.0.19-1+0~20170522122642.31+stretch~1.gbpfcdab8 amd64 [installed]
php7.0-opcache/unknown,now 7.0.19-1+0~20170522122642.31+stretch~1.gbpfcdab8 amd64 [installed]
php7.0-pspell/unknown,now 7.0.19-1+0~20170522122642.31+stretch~1.gbpfcdab8 amd64 [installed]
php7.0-readline/unknown,now 7.0.19-1+0~20170522122642.31+stretch~1.gbpfcdab8 amd64 [installed,automatic]
php7.0-recode/unknown,now 7.0.19-1+0~20170522122642.31+stretch~1.gbpfcdab8 amd64 [installed]
php7.0-sqlite3/unknown,now 7.0.19-1+0~20170522122642.31+stretch~1.gbpfcdab8 amd64 [installed]
php7.0-tidy/unknown,now 7.0.19-1+0~20170522122642.31+stretch~1.gbpfcdab8 amd64 [installed]
php7.0-xml/unknown,now 7.0.19-1+0~20170522122642.31+stretch~1.gbpfcdab8 amd64 [installed,automatic]
php7.0-xmlrpc/unknown,now 7.0.19-1+0~20170522122642.31+stretch~1.gbpfcdab8 amd64 [installed]
php7.0-xsl/unknown,unknown,now 7.0.19-1+0~20170522122642.31+stretch~1.gbpfcdab8 all [installed]
php7.0-zip/unknown,now 7.0.19-1+0~20170522122642.31+stretch~1.gbpfcdab8 amd64 [installed,automatic]
php7.1/unknown,unknown,now 7.1.5-1+0~20170513113444.24+stretch~1.gbpe4bc94 all [installed,automatic]
php7.1-bz2/unknown,now 7.1.5-1+0~20170513113444.24+stretch~1.gbpe4bc94 amd64 [installed,automatic]
php7.1-cli/unknown,now 7.1.5-1+0~20170513113444.24+stretch~1.gbpe4bc94 amd64 [installed,automatic]
php7.1-common/unknown,now 7.1.5-1+0~20170513113444.24+stretch~1.gbpe4bc94 amd64 [installed,automatic]
php7.1-curl/unknown,now 7.1.5-1+0~20170513113444.24+stretch~1.gbpe4bc94 amd64 [installed,automatic]
php7.1-gd/unknown,now 7.1.5-1+0~20170513113444.24+stretch~1.gbpe4bc94 amd64 [installed,automatic]
php7.1-json/unknown,now 7.1.5-1+0~20170513113444.24+stretch~1.gbpe4bc94 amd64 [installed,automatic]
php7.1-mbstring/unknown,now 7.1.5-1+0~20170513113444.24+stretch~1.gbpe4bc94 amd64 [installed,automatic]
php7.1-mysql/unknown,now 7.1.5-1+0~20170513113444.24+stretch~1.gbpe4bc94 amd64 [installed,automatic]
php7.1-opcache/unknown,now 7.1.5-1+0~20170513113444.24+stretch~1.gbpe4bc94 amd64 [installed,automatic]
php7.1-readline/unknown,now 7.1.5-1+0~20170513113444.24+stretch~1.gbpe4bc94 amd64 [installed,automatic]
php7.1-xml/unknown,now 7.1.5-1+0~20170513113444.24+stretch~1.gbpe4bc94 amd64 [installed,automatic]
php7.1-zip/unknown,now 7.1.5-1+0~20170513113444.24+stretch~1.gbpe4bc94 amd64 [installed,automatic]

Virtualmin system information:

Operating system Debian Linux 8
Webmin version 1.840
Virtualmin version 5.07
Theme version Authentic Theme 18.48
Time on system Monday, May 29, 2017 6:32 PM
Kernel and CPU Linux 4.9.15-x86_64-linode81 on x86_64
Processor information Intel(R) Xeon(R) CPU E5-2680 v2 @ 2.80GHz, 4 cores

Note the /etc/debian-version reports 9.0, not 8:

# cat /etc/debian_version
9.0
Mon, 05/29/2017 - 19:47
Joe
Joe's picture

Don't use mod_php if you can possibly avoid it. That shouldn't prevent install scripts from working, but it's just a good idea to use mod_fcgid (or the new php-fpm support, which is currently in beta in Virtualmin, but hasn't had any serious bugs filed against it that I'm aware of). That will allow the version code to work in Virtualmin, and it may be able to figure out what's going on and act right. If it still misbehaves under mod_fcgid and/or php-fpm, we may be dealing with a bug (could be a bug in our mod_php support, too, but we likely won't fix it, as it's being deprecated and mod_php use is strongly discouraged, by both us and the PHP developers).

mod_php support is being deprecated in Virtualmin 6; it'll be possible to turn it back on for people that really need it, but it won't be installed or configured by default, and it'll likely be completely removed in Virtualmin 7.

--

Check out the forum guidelines!

Mon, 05/29/2017 - 20:24 (Reply to #2)
jabowery

Menu path to disable mod_php please?

Mon, 05/29/2017 - 21:26
jabowery

There are no php modules loaded.

# apachectl -t -D DUMP_MODULES |grep -i php
#

I still get: This virtual server is using the mod_php execution mode for PHP, such does not allow per-directory version selection.

When I set Virtualmin -> Server Configuration -> Website Options -> FCGId (run as virtual server owner) I get: Failed to save website options : Missing or invalid website documents sub-directory When I open Virtualmin -> Server Configuration -> Website Options -> PHP Info I see: PHP versions installed No versions found! However, Virtualmin -> System Settings -> Re-check Configuration says: The following PHP versions are available : 5.6.30 (/usr/bin/php5-cgi), 5.6.30 (/usr/bin/php5.6), 7.0.19 (/usr/bin/php-cgi7.0), 7.1.5 (/usr/bin/php7.1)

Topic locked