Add some plausibility checks for commandline given php.ini values.
This commit is contained in:
		
							
								
								
									
										
											BIN
										
									
								
								.mod_php_install.sh.swp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								.mod_php_install.sh.swp
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							@@ -80,6 +80,10 @@ echo_skipped() {
 | 
				
			|||||||
   echo -e "\033[75G[ \033[33m\033[1mskipped\033[m ]"
 | 
					   echo -e "\033[75G[ \033[33m\033[1mskipped\033[m ]"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					is_int() {
 | 
				
			||||||
 | 
					   return $(test "$@" -eq "$@" > /dev/null 2>&1);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
detect_os_1 () {
 | 
					detect_os_1 () {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   if $(which lsb_release > /dev/null 2>&1) ; then
 | 
					   if $(which lsb_release > /dev/null 2>&1) ; then
 | 
				
			||||||
@@ -494,11 +498,28 @@ if [ -f "/usr/local/php-${MAJOR_VERSION}/etc/php.ini" ]; then
 | 
				
			|||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
MEMORY_LIMIT=""
 | 
					MEMORY_LIMIT=""
 | 
				
			||||||
echononl "memory_limit in Megabyte !! Append \"M\"? [$_MEMORY_LIMIT] "
 | 
					while [[ "X$MEMORY_LIMIT" = "X" ]]; do
 | 
				
			||||||
read MEMORY_LIMIT
 | 
					   echononl "memory_limit - Append unit \"K\", \"M\" or \"G\" [$_MEMORY_LIMIT] "
 | 
				
			||||||
if [ "X$MEMORY_LIMIT" = "X" ]; then
 | 
					   read MEMORY_LIMIT
 | 
				
			||||||
   MEMORY_LIMIT=$_MEMORY_LIMIT
 | 
					   if [ "X$MEMORY_LIMIT" = "X" ]; then
 | 
				
			||||||
fi
 | 
					      MEMORY_LIMIT=$_MEMORY_LIMIT
 | 
				
			||||||
 | 
					   fi
 | 
				
			||||||
 | 
					   if is_int $MEMORY_LIMIT ; then
 | 
				
			||||||
 | 
					      MEMORY_LIMIT="${MEMORY_LIMIT}M"
 | 
				
			||||||
 | 
					      warn "No unit is given. \"M\" was appended: memory_limit: $MEMORY_LIMIT"
 | 
				
			||||||
 | 
					      continue
 | 
				
			||||||
 | 
					   fi
 | 
				
			||||||
 | 
					   _unit="${MEMORY_LIMIT: -1}"
 | 
				
			||||||
 | 
					   if [[ "$_unit" != "K" ]] && [[ "$_unit" != "M" ]] && [[ "$_unit" != "G" ]]; then
 | 
				
			||||||
 | 
					      warn "Wrong unit was given for memory_limit. Reenter again"
 | 
				
			||||||
 | 
					      MEMORY_LIMIT=""
 | 
				
			||||||
 | 
					      continue
 | 
				
			||||||
 | 
					   fi
 | 
				
			||||||
 | 
					   if ! is_int ${MEMORY_LIMIT::-1} ; then
 | 
				
			||||||
 | 
					      warn "Wrong value for memory_limit. was given. Reenter again"
 | 
				
			||||||
 | 
					      MEMORY_LIMIT=""
 | 
				
			||||||
 | 
					   fi
 | 
				
			||||||
 | 
					done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## - php.ini: max_execution_time
 | 
					## - php.ini: max_execution_time
 | 
				
			||||||
if [ -f "/usr/local/php-${MAJOR_VERSION}/etc/php.ini" ]; then
 | 
					if [ -f "/usr/local/php-${MAJOR_VERSION}/etc/php.ini" ]; then
 | 
				
			||||||
@@ -509,11 +530,17 @@ if [ -f "/usr/local/php-${MAJOR_VERSION}/etc/php.ini" ]; then
 | 
				
			|||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
MAX_EXECUTION_TIME=""
 | 
					MAX_EXECUTION_TIME=""
 | 
				
			||||||
echononl "max_execution_time (in Seconds)  !! insert ONLY the number? [$_MAX_EXECUTION_TIME] "
 | 
					while [[ "X$MAX_EXECUTION_TIME" = "X" ]]; do
 | 
				
			||||||
read MAX_EXECUTION_TIME
 | 
					   echononl "max_execution_time (in Seconds)  !! insert ONLY the number? [$_MAX_EXECUTION_TIME] "
 | 
				
			||||||
if [ "X$MAX_EXECUTION_TIME" = "X" ]; then
 | 
					   read MAX_EXECUTION_TIME
 | 
				
			||||||
   MAX_EXECUTION_TIME=$_MAX_EXECUTION_TIME
 | 
					   if [ "X$MAX_EXECUTION_TIME" = "X" ]; then
 | 
				
			||||||
fi
 | 
					      MAX_EXECUTION_TIME=$_MAX_EXECUTION_TIME
 | 
				
			||||||
 | 
					   fi
 | 
				
			||||||
 | 
					   if ! is_int ${MAX_EXECUTION_TIME} ; then
 | 
				
			||||||
 | 
					      warn "Wrong value for max_execution_time was given. Reenter again"
 | 
				
			||||||
 | 
					      MAX_EXECUTION_TIME=""
 | 
				
			||||||
 | 
					   fi
 | 
				
			||||||
 | 
					done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## - php.ini: upload_max_filesize
 | 
					## - php.ini: upload_max_filesize
 | 
				
			||||||
if [ -f "/usr/local/php-${MAJOR_VERSION}/etc/php.ini" ]; then
 | 
					if [ -f "/usr/local/php-${MAJOR_VERSION}/etc/php.ini" ]; then
 | 
				
			||||||
@@ -532,11 +559,17 @@ if [ -f "/usr/local/php-${MAJOR_VERSION}/etc/php.ini" ]; then
 | 
				
			|||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
MAX_INPUT_TIME=""
 | 
					MAX_INPUT_TIME=""
 | 
				
			||||||
echononl "max_input_time (in Seconds)  !! insert ONLY the number? [$_MAX_INPUT_TIME] "
 | 
					while [[ "X$MAX_INPUT_TIME" = "X" ]]; do
 | 
				
			||||||
read MAX_INPUT_TIME
 | 
					   echononl "max_input_time (in Seconds)  !! insert ONLY the number? [$_MAX_INPUT_TIME] "
 | 
				
			||||||
if [ "X$MAX_INPUT_TIME" = "X" ]; then
 | 
					   read MAX_INPUT_TIME
 | 
				
			||||||
   MAX_INPUT_TIME=$_MAX_INPUT_TIME
 | 
					   if [ "X$MAX_INPUT_TIME" = "X" ]; then
 | 
				
			||||||
fi
 | 
					      MAX_INPUT_TIME=$_MAX_INPUT_TIME
 | 
				
			||||||
 | 
					   fi
 | 
				
			||||||
 | 
					   if ! is_int ${MAX_INPUT_TIME} ; then
 | 
				
			||||||
 | 
					      warn "Wrong value for max_input_time was given. Reenter again"
 | 
				
			||||||
 | 
					      MAX_INPUT_TIME=""
 | 
				
			||||||
 | 
					   fi
 | 
				
			||||||
 | 
					done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## - php.ini: upload_max_filesize
 | 
					## - php.ini: upload_max_filesize
 | 
				
			||||||
if [ -f "/usr/local/php-${MAJOR_VERSION}/etc/php.ini" ]; then
 | 
					if [ -f "/usr/local/php-${MAJOR_VERSION}/etc/php.ini" ]; then
 | 
				
			||||||
@@ -547,11 +580,28 @@ if [ -f "/usr/local/php-${MAJOR_VERSION}/etc/php.ini" ]; then
 | 
				
			|||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
UPLOAD_MAX_FILESIZE=""
 | 
					UPLOAD_MAX_FILESIZE=""
 | 
				
			||||||
echononl "upload_max_filesize in Megabyte !! Append \"M\"? [$_UPLOAD_MAX_FILESIZE] "
 | 
					while [[ "X$UPLOAD_MAX_FILESIZE" = "X" ]]; do
 | 
				
			||||||
read UPLOAD_MAX_FILESIZE
 | 
					   echononl "upload_max_filesize - Append unit \"K\", \"M\" or \"G\" [$_UPLOAD_MAX_FILESIZE] "
 | 
				
			||||||
if [ "X$UPLOAD_MAX_FILESIZE" = "X" ]; then
 | 
					   read UPLOAD_MAX_FILESIZE
 | 
				
			||||||
   UPLOAD_MAX_FILESIZE=$_UPLOAD_MAX_FILESIZE
 | 
					   if [ "X$UPLOAD_MAX_FILESIZE" = "X" ]; then
 | 
				
			||||||
fi
 | 
					      UPLOAD_MAX_FILESIZE=$_UPLOAD_MAX_FILESIZE
 | 
				
			||||||
 | 
					   fi
 | 
				
			||||||
 | 
					   if is_int $UPLOAD_MAX_FILESIZE ; then
 | 
				
			||||||
 | 
					      UPLOAD_MAX_FILESIZE="${UPLOAD_MAX_FILESIZE}M"
 | 
				
			||||||
 | 
					      warn "No unit is given. \"M\" was appended: upload_max_filesize: $UPLOAD_MAX_FILESIZE"
 | 
				
			||||||
 | 
					      continue
 | 
				
			||||||
 | 
					   fi
 | 
				
			||||||
 | 
					   _unit="${UPLOAD_MAX_FILESIZE: -1}"
 | 
				
			||||||
 | 
					   if [[ "$_unit" != "K" ]] && [[ "$_unit" != "M" ]] && [[ "$_unit" != "G" ]]; then
 | 
				
			||||||
 | 
					      warn "Wrong unit was given for upload_max_filesize Reenter again"
 | 
				
			||||||
 | 
					      UPLOAD_MAX_FILESIZE=""
 | 
				
			||||||
 | 
					      continue
 | 
				
			||||||
 | 
					   fi
 | 
				
			||||||
 | 
					   if ! is_int ${UPLOAD_MAX_FILESIZE::-1} ; then
 | 
				
			||||||
 | 
					      warn "Wrong value for upload_max_filesize was given. Reenter again"
 | 
				
			||||||
 | 
					      UPLOAD_MAX_FILESIZE=""
 | 
				
			||||||
 | 
					   fi
 | 
				
			||||||
 | 
					done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## - php.ini: post_max_size
 | 
					## - php.ini: post_max_size
 | 
				
			||||||
if [ -f "/usr/local/php-${MAJOR_VERSION}/etc/php.ini" ]; then
 | 
					if [ -f "/usr/local/php-${MAJOR_VERSION}/etc/php.ini" ]; then
 | 
				
			||||||
@@ -562,11 +612,28 @@ if [ -f "/usr/local/php-${MAJOR_VERSION}/etc/php.ini" ]; then
 | 
				
			|||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
POST_MAX_SIZE=""
 | 
					POST_MAX_SIZE=""
 | 
				
			||||||
echononl "post_max_size in Megabyte !! Append \"M\"? [$_POST_MAX_SIZE] "
 | 
					while [[ "X$POST_MAX_SIZE" = "X" ]]; do
 | 
				
			||||||
read POST_MAX_SIZE
 | 
					   echononl "post_max_size -  Append unit \"K\", \"M\" or \"G\" [$_POST_MAX_SIZE] "
 | 
				
			||||||
if [ "X$POST_MAX_SIZE" = "X" ]; then
 | 
					   read POST_MAX_SIZE
 | 
				
			||||||
   POST_MAX_SIZE=$_POST_MAX_SIZE
 | 
					   if [ "X$POST_MAX_SIZE" = "X" ]; then
 | 
				
			||||||
fi
 | 
					      POST_MAX_SIZE=$_POST_MAX_SIZE
 | 
				
			||||||
 | 
					   fi
 | 
				
			||||||
 | 
					   if is_int $POST_MAX_SIZE ; then
 | 
				
			||||||
 | 
					      POST_MAX_SIZE="${POST_MAX_SIZE}M"
 | 
				
			||||||
 | 
					      warn "No unit was given. So I apaended \"M\": post_max_size: $POST_MAX_SIZE"
 | 
				
			||||||
 | 
					      continue
 | 
				
			||||||
 | 
					   fi
 | 
				
			||||||
 | 
					   _unit="${POST_MAX_SIZE: -1}"
 | 
				
			||||||
 | 
					   if [[ "$_unit" != "K" ]] && [[ "$_unit" != "M" ]] && [[ "$_unit" != "G" ]]; then
 | 
				
			||||||
 | 
					      warn "Wrong unit was given for post_max_size. Reenter again"
 | 
				
			||||||
 | 
					      POST_MAX_SIZE=""
 | 
				
			||||||
 | 
					      continue
 | 
				
			||||||
 | 
					   fi
 | 
				
			||||||
 | 
					   if ! is_int ${POST_MAX_SIZE::-1} ; then
 | 
				
			||||||
 | 
					      warn "Wrong value for post_max_size was given. Reenter again"
 | 
				
			||||||
 | 
					      POST_MAX_SIZE=""
 | 
				
			||||||
 | 
					   fi
 | 
				
			||||||
 | 
					done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
echo ""
 | 
					echo ""
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user