virtualmin / virtualmin-gpl

Virtualmin web hosting control panel for Webmin
https://www.virtualmin.com
GNU General Public License v3.0
331 stars 102 forks source link

PHP Options disappearing. #899

Open redsector72 opened 2 months ago

redsector72 commented 2 months ago

This happened to me more than once on multiple servers. At first i thought it was my mistake, now I suppose there is a bug. I periodically use virtualmin interface to check php logs, and sometimes they are simply not listed under Logs and Reports. It's like PHP is not even enabled for the domain. I have to go to Webmin -> configuration and re enable PHP-PFM. But PHP Was already up and working for the website, so it's like virtualmin is not able to tell it's enabled.

I'm not sure what it checks to determine if php is enabled.

I have to say that I have a second issue that maybe is related. When I manually modify the directives (both SLL and not SLL) regarding <FilesMatch ".php"> it simply does not understand it and keep adding its lines to the config "at random times".

I change to this:

<FilesMatch "\.(inc|php|phtml|phps|php72)$">
    ProxyErrorOverride on
    <If "-f %{REQUEST_FILENAME}">
        SetHandler proxy:unix:/run/php/XXXXXXXX.sock|fcgi://127.0.0.1
    </If>
</FilesMatch>

and from time to time is simply re-add its line to the config. Maybe there's a way to change this behavior I was not able to find.

My system is Ubuntu 24.04.1, Webmin 2.202 and Virtualmin 7.20.2

iliajie commented 2 months ago

Hello,

Does this issue occur if you only use Virtualmin to change PHP execution mode/versions? Because we use different config options in Apache to enable PHP, and Virtualmin may simply not recognize your syntax.

redsector72 commented 2 months ago

hello @iliajie, I suppose the bug is in there. As I have changed the config manually and now the PHP part is gone again. I will do some test

redsector72 commented 2 months ago

So, I've made some test. It's not clear when, but seems like if I do remove or modify

`#<FilesMatch \.php$>
#    SetHandler proxy:unix:/run/php/XXXXX.sock|fcgi://127.0.0.1
#</FilesMatch>`

at some point Virtualmin looses the knowledge about PHP being enabled.

I suppose the check in the code is done badly as in my test I have found: 1) it adds the 3 lines at the end if I have modified the original one my way 2) it adds the 3 lines at the end if I have modified the original in any way, it seems like is checking for the full lines.

There is something I can do about this?

iliajie commented 2 months ago

Can you explain more about your use cases for:

<FilesMatch "\.(inc|php|phtml|phps|php72)$">
    ProxyErrorOverride on
    <If "-f %{REQUEST_FILENAME}">
        SetHandler proxy:unix:/run/php/XXXXXXXX.sock|fcgi://127.0.0.1
    </If>
</FilesMatch>