diff --git a/install/hst-install-rhel.sh b/install/hst-install-rhel.sh
index 291ddfa..a1577ae 100755
--- a/install/hst-install-rhel.sh
+++ b/install/hst-install-rhel.sh
@@ -1151,6 +1151,12 @@ chmod 660 $HESTIA/conf/hestia.conf
 # If a custom port is specified it will be set at the end of the installation process.
 write_config_value "BACKEND_PORT" "8083"
 
+if [ "$uselocalphp" == "yes" ]; then
+	write_config_value "LOCAL_PHP" "yes"
+else
+	write_config_value "LOCAL_PHP" "no"
+fi
+
 # Web stack
 if [ "$apache" = 'yes' ]; then
 	write_config_value "WEB_SYSTEM" "httpd"
@@ -1292,6 +1298,9 @@ rm -f $HESTIA/data/firewall/ipset/blacklist.sh $HESTIA/data/firewall/ipset/black
 # Installing apis
 cp -rf $HESTIA_COMMON_DIR/api $HESTIA/data/
 
+# Set system php for selector
+hestiacp-php-admin system "$php_v"
+
 # Configuring server hostname
 $HESTIA/bin/v-change-sys-hostname $servername > /dev/null 2>&1
 
@@ -1478,12 +1487,21 @@ if [ "$phpfpm" = "yes" ]; then
 
 	echo "[ * ] Configuring PHP $php_v..."
 	# Create www.conf for webmail and php(*)admin
-	cp -f $HESTIA_INSTALL_DIR/php-fpm/www.conf /etc/opt/remi/php${php_v}/php-fpm.d
-	systemctl enable php${php_v}-php-fpm --now >> $LOG
-	check_result $? "php-fpm start failed"
-	# Set default php version to $php_v
-	alternatives --install /usr/bin/php php /usr/bin/php$php_v 1 > /dev/null 2>&1
-	alternatives --set php /usr/bin/php$php_v > /dev/null 2>&1
+	if [ "$uselocalphp" == "yes" ]; then
+		cp -f $HESTIA_INSTALL_DIR/php-fpm/www.conf /opt/brepo/php${php_v}/etc/php-fpm.d
+		systemctl enable brepo-php-fpm${php_v}.service --now >> $LOG
+		check_result $? "php-fpm start failed"
+		# Set default php version to $php_v
+		alternatives --install /usr/bin/php php /opt/brepo/php${php_v}/bin/php 1 > /dev/null 2>&1
+		alternatives --set php /opt/brepo/php${php_v}/bin/php > /dev/null 2>&1 
+	else
+		cp -f $HESTIA_INSTALL_DIR/php-fpm/www.conf /etc/opt/remi/php${php_v}/php-fpm.d
+		systemctl enable php${php_v}-php-fpm --now >> $LOG
+		check_result $? "php-fpm start failed"
+		# Set default php version to $php_v
+		alternatives --install /usr/bin/php php /usr/bin/php$php_v 1 > /dev/null 2>&1
+		alternatives --set php /usr/bin/php$php_v > /dev/null 2>&1
+	fi
 fi
 
 #----------------------------------------------------------#