php5.conf contains SetHandler

22 posts / 0 new
Last post
#1 Tue, 01/03/2012 - 10:22
johnmazurka

php5.conf contains SetHandler

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

Wed, 01/04/2012 - 12:33
andreychek

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

Wed, 01/04/2012 - 15:16 (Reply to #2)
jbtbnl

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

Wed, 01/04/2012 - 23:00 (Reply to #3)
andreychek

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

Wed, 01/04/2012 - 16:46
johnmazurka

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

Thu, 01/05/2012 - 04:16
jbtbnl

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

Thu, 01/05/2012 - 07:46
andreychek

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

Thu, 01/05/2012 - 08:08
jbtbnl

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

Fri, 01/06/2012 - 15:58
Shirehosting

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

Sun, 04/15/2012 - 17:16
shinnphoto

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
Sun, 04/15/2012 - 23:04
shinnphoto

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

Sun, 04/15/2012 - 23:35
andreychek

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

Thu, 05/10/2012 - 23:40
shinnphoto

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

Fri, 05/11/2012 - 07:47
andreychek

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

Fri, 05/11/2012 - 19:11
shinnphoto

Thanks, Eric!

Thu, 07/24/2014 - 10:13
kieranlittle667

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.

Thu, 07/24/2014 - 10:30
andreychek

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

Thu, 07/24/2014 - 10:46
kieranlittle667

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.

Thu, 07/24/2014 - 14:26
andreychek

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

Mon, 07/28/2014 - 10:02
kieranlittle667

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.

Mon, 07/28/2014 - 10:31
andreychek

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

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

Mon, 07/28/2014 - 13:20 (Reply to #21)
kieranlittle667

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

Topic locked