get PHP-TCP address and port

This commit is contained in:
Asif Bacchus 2019-01-05 06:00:41 -07:00
parent b8520834ce
commit 6642a38d28
2 changed files with 54 additions and 2 deletions

View File

@ -11,8 +11,8 @@
-1,
-1,
-1,
-1,
553
628,
538
]
}
]

View File

@ -522,6 +522,56 @@ if [ "${usePHP}" -eq 1 ]; then
done
fi
# PHP-TCP: get address and port information
if [ "${phpType}" = "tcp" ]; then
while true; do
read -p "What IP address is PHP-FPM listening on? (default: 127.0.0.1) " inputPHPAddr
case "${inputPHPAddr}" in
'')
phpAddr="127.0.0.1"
break
;;
[Xx]*)
echo -e "\n${cyan}---exiting---\n${norm}"
exit 1
;;
*)
# check basic format validity
if [[ "${inputPHPAddr}" =~ ^${regexIP6}$ ]] || [[ "${inputPHPAddr}" =~ ^${regexIP4}$ ]]; then
phpAddr="${inputPHPAddr}"
break
else
echo -e "\n${err}Invalid IP4/IP6 address format${norm}"
fi
;;
esac
done
while true; do
read -p "What port is PHP-FPM listening on? (default: 9000) " inputPHPPort
case "${inputPHPPort}" in
'')
phpPort=9000
break
;;
[Xx]*)
echo -e "\n${cyan}---exiting---\n${norm}"
exit 1
;;
*)
# check port range validity
if [ "${inputPHPPort}" -ge 0 ] && [ "${inputPHPPort}" -le 65535 ]; then
phpPort="${inputPHPPort}"
break
else
echo -e "\n${err}Port must be between 0-65535${norm}"
fi
;;
esac
done
fi
: <<'COMMENTSECTION'
### Write configurations to template files
@ -592,6 +642,8 @@ echo -e "${cyan}--------------------${norm}"
echo "usePHP: $usePHP"
echo "PHP Version: $phpVersion"
echo "PHP listen type: $phpType"
echo "PHP address: $phpAddr"
echo "PHP port: $phpPort"
echo -e "${mag}---------------------${norm}\n"