Skip to content

Commit

Permalink
Get latest memory_limit from php.ini and convert -1 to Unlimited (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
dimon222 authored and willemdh committed May 8, 2017
1 parent 94c7641 commit b3e92aa
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions FireMotD
Original file line number Diff line number Diff line change
Expand Up @@ -349,10 +349,17 @@ GatherInfo () {
ProcessMax="$($SysctlPath -n kernel.pid_max)"
PhpVersion="$(/usr/bin/php -v 2>/dev/null | grep -oE '^PHP\s[0-9]+\.[0-9]+\.[0-9]+' | awk '{ print $2}')"
if [ -f /etc/php.ini ] ; then
PhpMaxMemory=$(grep -F memory_limit /etc/php.ini | sed -n 's/.* = \([0-9]*\)/\1/p' | sed 's/; .*//g')
PhpMaxMemory="/etc/php.ini"
elif [ -f /etc/php5/fpm/php.ini ] ; then
PhpMaxMemory=$(grep -F memory_limit /etc/php5/fpm/php.ini | sed -n 's/.* = \([0-9]*\)/\1/p' | sed 's/; .*//g')
PhpMaxMemory="/etc/php5/fpm/php.ini"
fi

PhpMaxMemory=$(tac $PhpMaxMemory | grep -F -m 1 memory_limit | sed -n 's/.* = \([0-9]*\)/\1/p' | sed 's/; .*//g')

if [[ "$PhpMaxMemory" == "-1" ]]; then
PhpMaxMemory="Unlimited"
fi

MaxLeftOverChars=35
Hostname="$(hostname)"
HostChars=$((${#Hostname} + 8))
Expand Down

0 comments on commit b3e92aa

Please sign in to comment.