Dotdeb PHP7 issue

Hi

I've installed Dotdeb PHP7 on Debian Jessie with great result on Drupal, Prestashop and Dolibarr, all running since earlier on mode_php with extensive use of .htaccess.

But now I can't have PHP executing on new installations of PHP based applications. When I go to "Virtualmin / Server configuration" there is no option to choose "mode_php" under "PHP script execution mode" as it was before, there are just "CGI wrapper (run as virtual server owner)" and "FCGId (run as virtual server owner)" to choose. On top of that, when I choose one of those two options, the setting is not saved after I've clicked on Save. When I go back after I've saved, the checkbox for the option I've just choosed is empty.

The above is valid for all domains, for the old ones as well as for the new ones that I'm creating (but as said, the old ones are running just fine)

Can anyone tell me where the problem is; what have I done wrong?

All the best

Hans

Configuration

Operating system Debian Linux 8 Webmin version 1.821 Virtualmin version 5.05 Theme version Authentic Theme 18.10 Kernel and CPU Linux 3.16.0-4-amd64 on x86_64

(I've also posted this to the Forums before I rememberd I have a PRO Version)

Status: 
Closed (fixed)

Comments

Howdy -- we unfortunately haven't done any testing with third party repositories for PHP, so it is possible that you could run into problems with those.

There's a few things you can try though.

First, what output do you receive if you go into System Settings -> Re-Check Config?

Second, what output do you receive if you run the command "php-cgi -v"?

Your system has 1.96 GB of memory, which is at or above the Virtualmin recommended minimum of 256 MB. Mail server Postfix is installed and configured.

Postfix can support per-domain outgoing IP addresses, but is not currently configured to do so. This can be setup in the Postfix Mailserver module.

Apache is installed.

The following PHP versions are available : 7.0.14 (/usr/bin/php-cgi7.0)

Webalizer is installed.

Apache is configured to host SSL websites.

MySQL is installed and running.

ProFTPD is installed.

Logrotate is installed.

SpamAssassin and Procmail are installed and configured for use.

ClamAV is installed and assumed to be running.

Plugin AWstats reporting is installed OK.

Plugin Administrator's Notes is installed OK.

Plugin DAV Login is installed OK.

Plugin Git repositories is installed OK.

Plugin Mailman is installed OK.

Plugin Protected web directories is installed OK.

Plugin Additional content styles is installed OK.

Plugin Virtualmin Support Links is installed OK.

Using network interface eth0 for virtual IPs.

Default IPv4 address for virtual servers is 212.23.192.87.

Default IP address is set to 212.23.192.87, which matches the detected external address.

Both user and group quotas are enabled for home and email directories.

All commands needed to create and restore backups are installed.

Resource limits are supported and configured correctly.

The selected package management and update systems are installed OK.

.. your system is ready for use by Virtualmin.

and *********************************************************** ************************************************************

php-cgi -v Failed loading /usr/local/lib/php/20121212-zts/opcache.so: /usr/local/lib/php/20121212-zts/opcache.so: cannot open shared object file: No such file or directory PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/pdo_mysql.so' - /usr/lib/php/20151012/pdo_mysql.so: undefined symbol: mysqlnd_allocator in Unknown on line 0

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/php_mysqli.so' - /usr/lib/php/20151012/php_mysqli.so: cannot open shared object file: No such file or directory in Unknown on line 0

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/php7_curl.so' - /usr/lib/php/20151012/php7_curl.so: cannot open shared object file: No such file or directory in Unknown on line 0

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/php7_gd.so' - /usr/lib/php/20151012/php7_gd.so: cannot open shared object file: No such file or directory in Unknown on line 0

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/php7_mysql' - /usr/lib/php/20151012/php7_mysql: cannot open shared object file: No such file or directory in Unknown on line 0

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/php_mysqli.dll' - /usr/lib/php/20151012/php_mysqli.dll: cannot open shared object file: No such file or directory in Unknown on line 0

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/ffmpeg.so' - /usr/lib/php/20151012/ffmpeg.so: cannot open shared object file: No such file or directory in Unknown on line 0

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/openssl.so' - /usr/lib/php/20151012/openssl.so: cannot open shared object file: No such file or directory in Unknown on line 0

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/hash.so' - /usr/lib/php/20151012/hash.so: cannot open shared object file: No such file or directory in Unknown on line 0

PHP Warning: Module 'curl' already loaded in Unknown on line 0

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/filter.so' - /usr/lib/php/20151012/filter.so: cannot open shared object file: No such file or directory in Unknown on line 0

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/mysql.so' - /usr/lib/php/20151012/mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/zlib.so' - /usr/lib/php/20151012/zlib.so: cannot open shared object file: No such file or directory in Unknown on line 0

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/pcntl.so' - /usr/lib/php/20151012/pcntl.so: cannot open shared object file: No such file or directory in Unknown on line 0

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/pdf.so' - /usr/lib/php/20151012/pdf.so: cannot open shared object file: No such file or directory in Unknown on line 0

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/session.so' - /usr/lib/php/20151012/session.so: cannot open shared object file: No such file or directory in Unknown on line 0

PHP Warning: Module 'PDO' already loaded in Unknown on line 0

PHP Warning: Module 'xml' already loaded in Unknown on line 0

PHP Warning: Module 'bcmath' already loaded in Unknown on line 0

PHP Warning: Module 'bz2' already loaded in Unknown on line 0

PHP Warning: Module 'calendar' already loaded in Unknown on line 0

PHP Warning: Module 'ctype' already loaded in Unknown on line 0

PHP Warning: Module 'curl' already loaded in Unknown on line 0

PHP Warning: Module 'dba' already loaded in Unknown on line 0

PHP Warning: Module 'dom' already loaded in Unknown on line 0

PHP Warning: Module 'exif' already loaded in Unknown on line 0

PHP Warning: Module 'fileinfo' already loaded in Unknown on line 0

PHP Warning: Module 'ftp' already loaded in Unknown on line 0

PHP Warning: Module 'gd' already loaded in Unknown on line 0

PHP Warning: Module 'gettext' already loaded in Unknown on line 0

PHP Warning: Module 'gmp' already loaded in Unknown on line 0

PHP Warning: Module 'iconv' already loaded in Unknown on line 0

PHP Warning: Module 'imap' already loaded in Unknown on line 0

PHP Warning: Module 'json' already loaded in Unknown on line 0

PHP Warning: Module 'ldap' already loaded in Unknown on line 0

PHP Warning: Module 'mbstring' already loaded in Unknown on line 0

PHP Warning: Module 'mcrypt' already loaded in Unknown on line 0

PHP Warning: Module 'pdo_sqlite' already loaded in Unknown on line 0

PHP Warning: Module 'Phar' already loaded in Unknown on line 0

PHP Warning: Module 'posix' already loaded in Unknown on line 0

PHP Warning: Module 'shmop' already loaded in Unknown on line 0

PHP Warning: Module 'SimpleXML' already loaded in Unknown on line 0

PHP Warning: Module 'soap' already loaded in Unknown on line 0

PHP Warning: Module 'sockets' already loaded in Unknown on line 0

PHP Warning: Module 'sqlite3' already loaded in Unknown on line 0

PHP Warning: Module 'sysvmsg' already loaded in Unknown on line 0

PHP Warning: Module 'sysvsem' already loaded in Unknown on line 0

PHP Warning: Module 'sysvshm' already loaded in Unknown on line 0

PHP Warning: Module 'tokenizer' already loaded in Unknown on line 0

PHP Warning: Module 'wddx' already loaded in Unknown on line 0

PHP Warning: Module 'xmlreader' already loaded in Unknown on line 0

PHP Warning: Module 'xmlrpc' already loaded in Unknown on line 0

PHP Warning: Module 'xmlwriter' already loaded in Unknown on line 0

PHP Warning: Module 'xsl' already loaded in Unknown on line 0

PHP Warning: Module 'zip' already loaded in Unknown on line 0

Security Alert! The PHP CGI cannot be accessed directly.

This PHP CGI binary was compiled with force-cgi-redirect enabled. This means that a page will only be served up if the REDIRECT_STATUS CGI variable is set, e.g. via an Apache Action directive.

For more information as to why this behaviour exists, see the manual page for CGI security.

For more information about changing this behaviour or re-enabling this webserver, consult the installation file that came with this distribution, or visit the manual page.

It looks like your PHP configs are expecting some things that were previously installed to be there -- but I think installing the new PHP version has those not working.

I suspect the primary errors are these:

Failed loading /usr/local/lib/php/20121212-zts/opcache.so: /usr/local/lib/php/20121212-zts/opcache.so: cannot open shared object file: No such file or directory
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/pdo_mysql.so' - /usr/lib/php/20151012/pdo_mysql.so: undefined symbol: mysqlnd_allocator in Unknown on line 0

My suggestion would be to find where it's trying to load "opcache.so", and "pdo_mysql.so", and either comment those out -- or install PHP7 versions of those modules.

Hi,

I've managed to get ridth of all errors, now it looks like this when running "php-cgi -v"

php-cgi -v Security Alert! The PHP CGI cannot be accessed directly.

This PHP CGI binary was compiled with force-cgi-redirect enabled. This means that a page will only be served up if the REDIRECT_STATUS CGI variable is set, e.g. via an Apache Action directive.

For more information as to why this behaviour exists, see the manual page for CGI security.

For more information about changing this behaviour or re-enabling this webserver, consult the installation file that came with this distribution, or visit the manual page.

But it does not solve my problem, I still can't run new installations and in "PHP script execution mode" there are only CGI wrapper (run as virtual server owner) and FCGId (run as virtual server owner) but no "mode_php" as earlier. And I can only choose FCGID as it will not save the setting if I choose CGI. (This is an improvment as I could not save FCGID either earlier)

Do you have any other suggestion?

Hans

That php-cgi output does look good. Just to verify that PHP in general is running, what output do you receive if you run the command "php -v"?

Also, what is it that's happening when trying to access PHP-based apps now? You mentioning it wasn't working, are you receiving an error of some sort?

Hi

I was wrong as It seem to work in that way I can run new sites as well as my old sites; it is exectuting PHP and below is the output of php -v

But I can still not choose mod_php, it does not appear as an option under "PHP script execution mode" and the only choise that work is either nothing or FCGID. When I try CGI wrapper the setting does not remain after I have saved.

PHP Warning: Module 'json' already loaded in Unknown on line 0 PHP 7.0.14-1~dotdeb+8.1 (cli) ( NTS ) Copyright (c) 1997-2016 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies with Zend OPcache v7.0.14-1~dotdeb+8.1, Copyright (c) 1999-2016, by Zend Technologies with Xdebug v2.5.0, Copyright (c) 2002-2016, by Derick Rethans

All the best

Hans

Okay, that "php -v" output looks good.

Let's start with looking into mod_php.

What output do you receive if you run this command:

apt-cache search libapache2-mod-php

bjarstal-com@protectionantivol:~/public_html$ apt-cache search libapache2-mod-php

libapache2-mod-php5 - server-side, HTML-embedded scripting language (Apache 2 module) libapache2-mod-php5filter - server-side, HTML-embedded scripting language (apache 2 filter module) php5-cgi - server-side, HTML-embedded scripting language (CGI binary) php5-fpm - server-side, HTML-embedded scripting language (FPM-CGI binary) libapache2-mod-php - server-side, HTML-embedded scripting language (Apache 2 module) (default) libapache2-mod-php7.0 - server-side, HTML-embedded scripting language (Apache 2 module) php7.0-fpm - server-side, HTML-embedded scripting language (FPM-CGI binary)

Remembering that we're not familiar with the dotdeb repo, and haven't done any testing to ensure that it doesn't cause problems or works well with Virtualmin --

If you wish to try and get mod_php for PHP7 working, you would need to have the "libapache2-mod-php7.0" package installed.

Now, we'd generally recommend testing all that on a test server before trying it on your production server.

However, since things are already not working, you could always give it a try :-)

Hi Thanks for your effort.

When doing a dpkg --list I can see it is already installed !!!

libapache2-mod-php7.0 7.0.14-1~dotdeb+8.1

Hans

Okay, it does indeed appear to be installed.

We can also verify that it's enabled -- what is the output of this command:

ls /etc/apache2/mods-enabled

access_compat.load authn_dbm.load autoindex.conf dav_fs.load encoding.load info.conf mime.load proxy.conf ratelimit.load setenvif.load unique_id.load actions.conf authn_file.load autoindex.load dav.load env.load info.load mime_magic.conf proxy_connect.load reflector.load slotmem_plain.load userdir.conf actions.load authn_socache.load buffer.load dav_lock.load expires.load lbmethod_bybusyness.load mime_magic.load proxy_express.load remoteip.load slotmem_shm.load userdir.load alias.conf authnz_fcgi.load cache_disk.conf dav_svn.conf ext_filter.load lbmethod_byrequests.load mpm_prefork.conf proxy_fcgi.load reqtimeout.conf socache_dbm.load usertrack.load alias.load authnz_ldap.load cache_disk.load dav_svn.load fcgid.conf lbmethod_bytraffic.load mpm_prefork.load proxy_fdpass.load reqtimeout.load socache_memcache.load vhost_alias.load allowmethods.load authz_core.load cache.load dbd.load fcgid.load lbmethod_heartbeat.load negotiation.conf proxy_ftp.conf request.load socache_shmcb.load xml2enc.load asis.load authz_dbd.load cache_socache.load deflate.conf file_cache.load ldap.conf negotiation.load proxy_ftp.load rewrite.load speling.load auth_basic.load authz_dbm.load cgid.conf deflate.load filter.load ldap.load perl.load proxy_html.conf sed.load ssl.conf auth_digest.load authz_groupfile.load cgid.load dialup.load headers.load log_debug.load php7.0.conf proxy_html.load session_cookie.load ssl.load auth_form.load authz_host.load cgi.load dir.conf heartbeat.load log_forensic.load php7.0.load proxy_http.load session_crypto.load status.conf authn_anon.load authz_owner.load charset_lite.load dir.load heartmonitor.load lua.load proxy_ajp.load proxy.load session_dbd.load status.load authn_core.load authz_svn.load data.load dump_io.load ident.load macro.load proxy_balancer.conf proxy_scgi.load session.load substitute.load authn_dbd.load authz_user.load dav_fs.conf echo.load include.load mime.conf proxy_balancer.load proxy_wstunnel.load setenvif.conf suexec.load

According to what I see there, mod_php should be loading.

For one of your new domains, could you create a file in the public_html directory named "test.php", and for it's contents add in the following:

<?php phpinfo(); ?>

And then, could you share the resulting URL with us?

I do want to offer that it's possible the packages of this repository change the PHP config in an unusual way, and it may do things in a way that's incompatible with Virtualmin.

Hi

I have managed to kill all php execution. Almost. PHP is down on all pages except on my Dolibarr installation and I don't know why it is up running there. I have put the file in my dolibarr sub domain at

http://dolibarr.bjarstal.com/test.php

I suppose I have messed up the apache2.conf for the other domaines. Any suggustion how to celan it up? It is just 5 of them so I can reinstall if needed. I have tried to reinstall php5 but with no luck.

All the best

Hans

Okay, according to that test.php script, that particular domain is running PHP7 in mod_php mode.

What error or problem are you receiving with other domains when trying to access PHP?

Ok, I'm back, I had to go to sleep at 6 in the morning. For me it start to become relly seroious as my sites are down and I'm approaching a point where I'm prepered to pay for help to solve this quicly. Anyhow, let's make a try here first. In the next message I will answer you question and give more info.

  1. Earlier I could as I told you, not not choose PHP script execution mode. Firstly mod_php do not appear and seccondly the settings were not seaved when I tried to choose CGI wrapper or FCGId. In this situation my existing PHP sites worked but I couldn't have any new PHP site to work

  2. When doing php-cgi -v I had a lot of errors and after cleaning up little and also purging anything with php5 in the name, I got rid of all errors and on top I could start o choose CGI wrapper or FCGDi; the settings were saved.

  3. It was now the sites stopped working becase when trying to choose FCGDi just for testing, the PHP execution for that domain stopped and I could not restore it. It took me a little before I understood that it was the FCGDi that messed it up so I actually tried it on all sites except the one that works; http://dolibarr.bjarstal.com/test.php

  4. The situation now is that when trying an servvice apache2 reload I have error and that error also apears when doing a Re-Check Configuration. The result of the re-Check is ;

AH00526: Syntax error on line 304 of /etc/apache2/apache2.conf: Invalid command 'CGIWrapper', perhaps misspelled or defined by a module not included in the server configuration Action 'configtest' failed. The Apache error log may have more information.

  1. The problems with other domains are that they do not execute PHP, the code comes up on the screen or the file downloads to my local computer.

Hoping desperatly for help

All the best

Hans

Okay, issues 4 and 5 are the ones I want to focus on at the moment.

It looks like a domain is attempting to use the CGI mode, and the CGI module doesn't appear to be installed. Note that it's setup/enabled by default, so something appears to have disabled that particular module.

However, you can re-enable it by running this command:

a2enmod cgi

After that, restart Apache:

service apache2 restart

At that point, are you able to access the website?

If not, what error(s) are you seeing?

Just had this response

root@protectionantivol:/home/bjarstal-com/public_html# a2enmod cgi AH00526: Syntax error on line 298 of /etc/apache2/apache2.conf: Invalid command 'CGIWrapper', perhaps misspelled or defined by a module not included in the server configuration Module cgi already enabled

And I made the restart but then Apache went domn fully and it is down. Doing systemctl status apache2.service I had this answer

systemctl status apache2.service -l ● apache2.service - LSB: Apache2 web server Loaded: loaded (/etc/init.d/apache2) Drop-In: /lib/systemd/system/apache2.service.d └─forking.conf Active: failed (Result: exit-code) since Tue 2016-12-13 16:55:51 CET; 1min 48s ago Process: 22328 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS) Process: 18463 ExecReload=/etc/init.d/apache2 reload (code=exited, status=1/FAILURE) Process: 22357 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)

Dec 13 16:55:51 protectionantivol.fr apache2[22357]: Starting web server: apache2 failed! Dec 13 16:55:51 protectionantivol.fr apache2[22357]: The apache2 configtest failed. ... (warning). Dec 13 16:55:51 protectionantivol.fr apache2[22357]: Output of config test was: Dec 13 16:55:51 protectionantivol.fr apache2[22357]: AH00526: Syntax error on line 298 of /etc/apache2/apache2.conf: Dec 13 16:55:51 protectionantivol.fr apache2[22357]: Invalid command 'CGIWrapper', perhaps misspelled or defined by a module not included in the server configuration Dec 13 16:55:51 protectionantivol.fr apache2[22357]: Action 'configtest' failed. Dec 13 16:55:51 protectionantivol.fr apache2[22357]: The Apache error log may have more information. Dec 13 16:55:51 protectionantivol.fr systemd[1]: apache2.service: control process exited, code=exited status=1 Dec 13 16:55:51 protectionantivol.fr systemd[1]: Failed to start LSB: Apache2 web server. Dec 13 16:55:51 protectionantivol.fr systemd[1]: Unit apache2.service entered failed state.

It sounds like the CGI Apache module is set to load, but it may not be loading for some reason.

One thing you could try, just to see if this gets your Apache back online, is to try commenting out line 298 of your " /etc/apache2/apache2.conf" file, which begins with "CGIWrapper".

After that, see if you're able to start Apache again.

Alternatively, although I know this isn't saving in the Virtualmin GUI, it should still be effective -- you could try going into Virtualmin, Server Configuration -> Website Options for this particular domain, and try setting the PHP Execution Mode for that domain to FCGID.

Then, see if you're able to start Apache once that's changed.

If you get a similar error -- check to see if the error is for a different domain, or if it's the same one still.

I commented it out and I could restart Apache, but no error and PHP not executing.

When you say PHP isn't executing -- are you saying that the file is being downloaded instead?

If that's what you mean, what is the output of this command:

grep -i sethandler /etc/apache2/mods-enabled/php*

It's downloading

grep -i sethandler /etc/apache2/mods-enabled/php* /etc/apache2/mods-enabled/php7.0.conf: SetHandler application/x-httpd-php /etc/apache2/mods-enabled/php7.0.conf: SetHandler application/x-httpd-php-source

Okay, try editing this file here:

/etc/apache2/mods-enabled/php7.0.conf

And comment out the two lines that start with "SetHandler", and then restart Apache.

:) ) it is up running !!!

Thanks ! I did not relize that this file had changed after installing and reinstalling the different PHP versions .

There was these also this I had to out comment: Running PHP scripts in user directories is disabled by default

To re-enable PHP in user directories comment the following lines ........

So now everything is just great. For my PHP sites shall I use FCGId from now on?

A last question; I had to go for Dotdeb php7 as the difference in speed is dramaticall between php5 and php7 and Debian will not introduce it before Debian 9. When 9 is here next spring I will upgrade the server and I intend to make a clean installation. There will be no problems with the virutalmin license when doing that?

Thanks again very much !!!

Hans

Ah, I hadn't heard about Debian 9... are they predicting this coming spring for that, meaning it's just a few months away?

There's no problem with the licensing for that though, you're welcome to put your license on a second server for the purposes of a migration.

Fixed by your support and also an upgrade by you.