Re-check configuration issue and SetHandler

I had an earlier issue where I had manged to reinstall VirutalMin by running the installscript with the result that I lost a lot of Apache settings. Now there have turned up an other issue. When running Re-check configuration it will stop early with the error

Apache configuration file /etc/apache2/mods-enabled/php5.conf contains SetHandler lines that prevent PHP from running with domain owner permissions. These lines must be removed.

.. your system is not ready for use by Virtualmin.

The problem is that /etc/apache2/mods-enabled/php5.conf is a SymLink so it is not editble. When I tried to take it away I could not run any php based site.

In /etc/apache2/mods-available/php5.conf I could find the lines in question but when taking them away the php based sites does not work.

So when I either take away the mentionned SymLink or edit in mods-available/php5.conf the config check is happy, but the PHP-based sites are down. Othervise the Config check is unhappy but tthe sites works, with some problems in Drupal.

I know I took away those lines before my "accident".

Pls help, because I believe these lines causes some problems in Drupal.

Thanks

Hans

Status: 
Closed (fixed)

Comments

Howdy -- yes, it's normal for "/etc/apache2/mods-enabled/php5.conf" to be a symlink.

You would need the php5.conf file if your sites are using mod_php.

What PHP Execution Mode are your sites using? If they're using mod_php, they would indeed need that module to be enabled.

However, you shouldn't ever need the SetHandler lines in it.

When commenting out those SetHandler lines, what happens to your sites -- do you receive an error? If so, what error(s) do you see in $HOME/logs/error_log?

In Configure Apache modules CGID is checked.

I do not know what I had before my unfortunate reinstall. My problem is that I'm learning by doing/failing and I had system up running I had configured little by little and I am not sure what settings I had ended up in.

I am not sure what is the best to use and what I had earlier, just remeber I played around a lot with it.

When commeting out the lines in mods-available/php5.conf so it looks like this

# SetHandler application/x-httpd-php

SetHandler application/x-httpd-php-source
# Deny access to raw php sources by default
# To re-enable it's recommended to enable access to the files
# only in specific virtual host or directory
Require all denied

Deny access to files without filename (e.g. '.php')

Require all denied

Then Prestahop tells me this;

<?php /* * 2007-2015 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Open Software License (OSL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/osl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to license@prestashop.com so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA contact@prestashop.com * @copyright 2007-2015 PrestaShop SA * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) * International Registered Trademark & Property of PrestaShop SA */

require(dirname(FILE).'/config/config.inc.php'); Dispatcher::getInstance()->dispatch();

and WP

<?php /** * Front to the WordPress application. This file doesn't do anything, but loads * wp-blog-header.php which does and tells WordPress to load the theme. * * @package WordPress */

/** * Tells WordPress to load the WordPress theme and output it. * * @var bool */ define('WP_USE_THEMES', true);

/** Loads the WordPress Environment and Template */ require( dirname( FILE ) . '/wp-blog-header.php' );

and Drupal

<?php

/* Below is error code. To be unmarked in case of problems

error_reporting(E_ALL); ini_set('display_errors', TRUE); ini_set('display_startup_errors', TRUE);

// $Id: index.php,v 1.94 2007/12/26...

/** * @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();

So as you can see PHP does not work

And mod_php5 is enabled.

Out of curiosity, does it help to switch from CGI to FCGID? In that case, does your site work?

If so, it may just be that the CGI Apache module isn't enabled.

When we started this it was on CGID, I have tried CGI with the same result, but with FCGID Apache refuses to load, I got the below message

Failed to start apache : Starting apache2 (via systemctl): apache2.serviceJob for apache2.service failed. See 'systemctl status apache2.service' and 'journalctl -xn' for details. failed!

What error do you see in the Apache error log when that occurs?

That's located in /var/log/apache2/error_log.

Thu Dec 17 19:25:00.232926 2015] [suexec:notice] [pid 7966] AH01232: suEXEC mechanism enabled (wrapper: /usr/lib/apache2/suexec) [Thu Dec 17 19:25:00.300162 2015] [fcgid:emerg] [pid 7967] (2)No such file or directory: mod_fcgid: Can't create shared memory for size 1200712 bytes

Better so ?

Did you by chance recently upgrade from an earlier Debian version?

It sounds like there may be some Apache module problems occurring.

For one, you may want to run this command to verify that CGI is enabled:

a2enmod cgi

Next, what is the output of this command:

ls -ld /var/lib/apache2/fcgid

That directory needs to exist, and be writable by the Apache user (www-data).

It is a few month since I upgraded to Jessie so it should have no connection to this.

ls: cannot access /var/lib/apache2/fcgid: No such file or directory

I've created it now, with root:www-data and 770

Now I could load fcgid !!

But still not possible to take away SetHandler without killing PHP fully. OK it is late in France so I have to stop. Maybe you can figure something out for me so I will find it tomorrow.

Problem solved. It was me messing it up; there was a lot of things I hadn't understood at all. Learning by failing.

Thanks anyhow.

Great - I will mark this as fixed.