php5.conf contains SetHandler

  • johnmazurka
  • 01/03/12
  • Offline
Posted: Tue, 2012-01-03 11:22

Hi

am having probs rechecking Virtualmin configuration - I get the following message:

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

however, when I comment out the lines mentioned, apache delivers the source of the php file instead of the desired html type output.

here's my php5.conf

<IfModule mod_php5.c>
    <FilesMatch ".ph(p3?|tml)$">
   SetHandler application/x-httpd-php
    </FilesMatch>
    <FilesMatch ".phps$">
  SetHandler application/x-httpd-php-source
    </FilesMatch>
    # To re-enable php in user directories comment the following lines
    # (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
    # prevents .htaccess files from disabling it.
    <IfModule mod_userdir.c>
        <Directory /home/*/site>
            php_admin_value engine Off
        </Directory>
    </IfModule>
</IfModule>
any ideas any body? am on Ubuntu Linux 10.04.1

John


Howdy, Just to verify -- you

  • andreychek
  • 01/05/09
  • Online Now
  • Wed, 2012-01-04 13:33

Howdy,

Just to verify -- you did comment out both lines, and not just one? Normally that would work -- it's actually the default setting when performing a Virtualmin install.

How did you install Virtualmin -- did you by chance use the install.sh script?

And is this a fresh install of Ubuntu?

-Eric


Same issue here

  • jbtbnl
  • 06/02/11
  • Offline
  • Wed, 2012-01-04 16:16

Hello,

Once in a while I check if everything is running fine on my Virtualmin GPL installation. When I ran Re-Check Configuration this time I got the same message as John:

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

I'm running Ubuntu server 10.04 for 1.5 years.

I tried commenting the lines, removing the lines, but the error remains.

Regards, Jan


Hi Jan, Well, that

  • andreychek
  • 01/05/09
  • Online Now
  • Thu, 2012-01-05 00:00

Hi Jan,

Well, that particular error message was added in later on... it was discovered that, as long as those two lines existed in the php5.conf file, all websites would run under mod_php, rather than CGI or FCGID.

By commenting those out, and restarting Apache -- you should then be able to select the mode that you want in Server Configuration -> Website options.

-Eric


Verifying...

  • johnmazurka
  • 01/03/12
  • Offline
  • Wed, 2012-01-04 17:46

Cheers for the reply Eric

Yes I commented out both lines and tried other combinations too.

Its not a fresh install, Ive been running it for a while and have updated it a number of times. Also its not really possible to do a fresh install, apart from the time to get it up and running as is again, its a uk2 server that we rent.

How I installed it I cant remember, but I think it was the install.sh

Virtualmin still seems to be functioning (without the comments) so it doesn't seem to be super urgent, but it would be good to clear it up to keep everything ship shape, and to avoid problems in the future.

cheers.

j


This seems to work:

  • jbtbnl
  • 06/02/11
  • Offline
  • Thu, 2012-01-05 05:16

OK thanks Eric, instead of commenting what the message in the php5.conf file suggests, I commented the following lines:

<IfModule mod_php5.c>
    <FilesMatch ".ph(p3?|tml)$">
#       SetHandler application/x-httpd-php
    </FilesMatch>
    <FilesMatch ".phps$">
#       SetHandler application/x-httpd-php-source
    </FilesMatch>
    # To re-enable php in user directories comment the following lines
    # (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
    # prevents .htaccess files from disabling it.
    <IfModule mod_userdir.c>
        <Directory /home/*/public_html>
            php_admin_value engine Off
        </Directory>
    </IfModule>
</IfModule>
And now the configuration check is all satisfied. Now I wonder, is this the required configuration or must the <IfModule ...> to </IfModule> be commented out as well...?

Regards, Jan


Howdy, Actually, that's how

  • andreychek
  • 01/05/09
  • Online Now
  • Thu, 2012-01-05 08:46

Howdy,

Actually, that's how it should look -- that looks perfect!

What you have above is what I figured you had done after your initial post though... how does what you have above differ from what you had before? If I understand that better, maybe we can make the error message you had received from Virtualmin more descriptive -- we'd love to make that simpler to fix!

Anyhow, the problem with those SetHandler lines is that they cause mod_php to override all other PHP settings on the system, and it prevents CGI and FCGID from being able to be used.

You don't need to comment out the IfModule lines, those are okay.

-Eric


You don't need to comment out

  • jbtbnl
  • 06/02/11
  • Offline
  • Thu, 2012-01-05 09:08

You don't need to comment out the IfModule lines, those are okay. Well, yes that was the confusing part, I went to the configuration file and the comment in there suggests to comment a few lines that are irrelevant to the issue.

I don't think that the message from Virtualmin could be much better, I guess that I should have read it more punctual in the first place.

Problem solved, thanks Eric!

Regards, Jan


I'm getting the exact same

  • Shirehosting
  • 05/12/10
  • Offline
  • Fri, 2012-01-06 16:58

I'm getting the exact same error on our GPL version as well. Been running for over a year now never seen this before. The only reason I recheck was I changed some process limits.

Funny how 2 of us get the same thing.

Michael


Had the same problem

  • shinnphoto
  • 07/11/09
  • Offline
  • Sun, 2012-04-15 17:16

I had the same problem, and this thread helped me sort it out. I think the error message could be cleaned up a little -

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

I think you may be missing the word 'prevent' before the word 'PHP' in the first sentence. (At least, I assume that's what you were trying to say.) It would also be nice to specify that there are two lines to comment out, and it's only the two individual lines, and not the entire section or the section below.

As always, thanks for the quick, responsive support. We appreciate it!

  • Andrew

Further problems

  • shinnphoto
  • 07/11/09
  • Offline
  • Sun, 2012-04-15 23:04

Hi, guys,

I made the configuration changes that we discussed here, and I thought everything was fine. A few hours later, I found out that my server wasn't serving some of the sites that people pay me to host. Yeek! When I un-commented those two lines, they started serving again. They're Wordpress sites. The main Wordpress blog I run on the server and all the static sites were serving just fine, but all other Wordpress sites were broken. Do I have a problem with the way mod_php or FCGI is configured for some of my virtual servers or something? Where do I look to figure that out?

Thanks, Andrew


I think you may be missing

  • andreychek
  • 01/05/09
  • Online Now
  • Sun, 2012-04-15 23:35

I think you may be missing the word 'prevent' before the word 'PHP'

You're right, thanks for the heads up! That will be fixed in the next version.

Do I have a problem with the way mod_php or FCGI is configured for some of my virtual servers or something?

Well, can you describe what problem you're having exactly?

Also, one thing you could do is change those sites back to mod_php, since that SetHandler line was forcing them to run under mod_php anyhow.

To do that, you could go into Server Configuration -> Website Options, where you change thange the PHP Execution Mode.

-Eric


Eric, the specific problem I

  • shinnphoto
  • 07/11/09
  • Offline
  • Thu, 2012-05-10 23:40

Eric, the specific problem I was having was that, after commenting out the two sethandler lines, some of my web sites weren't serving. I took your suggestion, and changed all the sites on my server to mod_php. That seems to take care of the problem. I'm not risking a performance hit by doing that, am I?

Thanks for the help, Andrew


No... mod_php is actually

  • andreychek
  • 01/05/09
  • Online Now
  • Fri, 2012-05-11 07:47

No... mod_php is actually slightly faster.

Using CGI and FCGID is considered to be more secure in a multi-user environment though.

If you're on a shared hosting server there, CGI/FCGID may be a better long-term solution in that regard. But certainly mod_php is better than the site not working at all :-)

If the site doesn't work under CGI/FCGID -- you may want to take a look in the logs, in $HOME/logs/error_log, to see if any errors show up there.

-Eric


Thanks, Eric!

  • shinnphoto
  • 07/11/09
  • Offline
  • Fri, 2012-05-11 19:11

Thanks, Eric!


I'm getting this problem

  • kieranlittle667
  • 07/24/14
  • Offline
  • Thu, 2014-07-24 10:13

Hi,
I know this is an old thread, but it's the only place I can seem to find that has relevant info on this issue.
I'm running Ubuntu 13.10 with Webmin 1.690, and I setup virtualmin yesterday and got several errors with my apache2 conf, I managed to fix the ones it through at me, but it through this one at me and I've tried all the suggestions on this thread but none of them work.
My php5.conf file looks like this:
----

# SetHandler application/x-httpd-php

# SetHandler application/x-httpd-php-source

# To re-enable php in user directories comment the following lines
# (from to .) Do NOT set it to On as it
# prevents .htaccess files from disabling it.

php_admin_value engine Off

----
The error I'm getting is:
----
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.
----
I've tried commenting lots of different things in that file, but none of them have worked.
The site is:
http://kieranl.me
Thanks,
Kieran.


Howdy, Unfortunately, Ubuntu

  • andreychek
  • 01/05/09
  • Online Now
  • Thu, 2014-07-24 10:30

Howdy,

Unfortunately, Ubuntu 13.10 isn't one of the distros supported by Virtualmin, so you're likely to run into some problems using that. Only the Ubuntu LTS releases are supported, so 12.04 and 14.04.

However, I'm a little surprised about the exact error you're seeing in this case, as it looks like those lines are properly commented out.

What output do you receive if you run this command:

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

If at all possible though we'd recommend using one of the supported Ubuntu versions.

-Eric


Hi, *Insert curse word of

  • kieranlittle667
  • 07/24/14
  • Offline
  • Thu, 2014-07-24 10:46

Hi,
*Insert curse word of choice here*.
I just installed this because it was the first option my provider gave me for an OS for my VPS, I'm not too sure if I can change it.
When I run that, I get:
----
[1] 6178
bash: nbsp: command not found
bash: /etc/apache2/mods-enabled/access_compat.load: Permission denied
----
Thanks,
Kieran.


Hmm, I suspect somehow the

  • andreychek
  • 01/05/09
  • Online Now
  • Thu, 2014-07-24 14:26

Hmm, I suspect somehow the command you're running isn't the command we were intending :-)

Can you paste in here the exact command you ran?

It sounds like it may have some HTML in it.

-Eric


Hi, Sorry for the delay in

  • kieranlittle667
  • 07/24/14
  • Offline
  • Mon, 2014-07-28 10:02

Hi, Sorry for the delay in replying. The exact command I ran was: sudo grep -i sethandler  /etc/apache2/mods-enabled/* I can't see any HTML in there, but again the outcome of that is: [2] 2830
bash: nbsp: command not found
bash: /etc/apache2/mods-enabled/access_compat.load: Permission denied I can live without webmail, I just wanted to have a more direct email address for my contact form than my personal one. Hope this helps. Thanks, Kieran.


Oh I think I see the issue,

  • andreychek
  • 01/05/09
  • Online Now
  • Mon, 2014-07-28 10:31

Oh I think I see the issue, try putting ' characters around the path in this command:

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


I tried running it, and it

  • kieranlittle667
  • 07/24/14
  • Offline
  • Mon, 2014-07-28 13:20

I tried running it, and it thought the * was a file, so I took that out and got: grep: /etc/apache2/mods-enabled/: Is a directory