Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Webmin php-lib.pl modification

Tags:

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.

like image 263
SnakeDrak Avatar asked Jul 08 '15 06:07

SnakeDrak


1 Answers

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; ... 
like image 77
Francesco Abeni Avatar answered Sep 28 '22 01:09

Francesco Abeni