From deb172ca8249c5069279612ad2015c860697f3d0 Mon Sep 17 00:00:00 2001 From: iliajie Date: Sun, 16 Jul 2023 13:09:19 +0300 Subject: [PATCH] Fix PHP detection from the path to work for all supported distros --- phpini/phpini-lib.pl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/phpini/phpini-lib.pl b/phpini/phpini-lib.pl index 7df25688e..81234a559 100755 --- a/phpini/phpini-lib.pl +++ b/phpini/phpini-lib.pl @@ -305,13 +305,13 @@ if (&foreign_check("virtual-server")) { } } -# Try to get version from the path -if ($file =~ /php(\d+)/) { +# Try to get version from the path, e.g. +# RHEL and derivatives /etc/opt/remi/php83 +# Debian/Ubuntu /etc/php/8.3/fpm/pool.d/www.conf +# RHEL and derivatives Debian/Ubuntu +if ($file =~ /php(\d+)/ || $file =~ /php\/([\d\.]+)/) { my $ver = $1; - my $nodot = $ver; - $nodot =~ s/\.//g; - my $binary = &has_command("php$ver") || - &has_command("php$nodot"); + my $binary = &has_command("php$ver"); return $binary if ($binary); } return &has_command("php");