Webmin php-lib.pl modification
Asked Answered
F

1

24

I have updated the PHP version to 5.5.26. With PHP 5.4 my Apache configuration with FCGI was:

AddHandler fcgid-script .php
AddHandler fcgid-script .php5

With the new version of PHP I need put other config to works:

<FilesMatch \.php$>
    SetHandler fcgid-script
</FilesMatch>

It’s OK, it’s working.

My problem is with Virtualmin module of Webmin. I don’t want to change the config every time, so I have edited the Perl file /usr/share/webmin/virtual-server/php-lib.pl:

# Directives for fcgid
local $dest = "$d->{'home'}/fcgi-bin";
#push(@phplines, "AddHandler fcgid-script .php");

# New config for PHP files
push(@phplines, "<FilesMatch \\.php\$>");
push(@phplines, "SetHandler fcgid-script");
push(@phplines, "</FilesMatch>");

push(@phplines, "FCGIWrapper $dest/php$ver.fcgi .php");
foreach my $v (&list_available_php_versions($d)) {
  #push(@phplines,
  #     "AddHandler fcgid-script .php$v->[0]");
  push(@phplines, "FCGIWrapper $dest/php$v->[0].fcgi " . ".php$v->[0]");
}

But my change does nothing, Webmin continues putting the lines AddHandler. I have restarted Webmin, I cleared the file /etc/webmin/module.infos.cache.

Firstfoot answered 8/7, 2015 at 6:53 Comment(5)
Is there a deploy function somewhere?Episcopacy
Put a line in to log to file to confirm that this is the script that is being called by webminAnagoge
I think the php tag is wrong.Prosody
The Perl does not respect programming best practices : use sigle quotes ' instead of dubblequote " if you are not using variable substitution, is to say everywhere in this code. Not a "Perl best practice" => often erroneous code... Try to remove variable substitution and to concatenate with ` . `.Analemma
Have you tried the answer by Francesco Abeni? If so, what was the result? If not, try it. I think it might be the case that you are editing save_domain_php_directory, but the AddHandler lines are actually generated by save_domain_php_mode.Bulbiferous
S
4

First of all you should use single quotes instead of double quotes for a simpler syntax:

...
push(@phplines, '<FilesMatch \.php$>');
push(@phplines, 'SetHandler fcgid-script');
push(@phplines, '</FilesMatch>');
...

Check this specific file for syntax errors with

perl -c /usr/share/webmin/virtual-server/php-lib.pl

Add a log file somewhere in this file so you are sure this file gets called at all. E.g. add something like this before the code shown above:

my $fh;
open($fh, '>>', "/tmp/test.log") or die "Couldn't open: $!";
print $fh "This file is actually used!";
close $fh;
...
Slake answered 27/8, 2015 at 12:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.