php-enable-fd-setsize.sh.j2 936 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#!/bin/bash

BUILD_FD_SIZE={{ php_sockets }}

PHP_CONFIG=$(which php-config)

if [[ "${PHP_CONFIG}" == "" ]]; then
  echo "This script depends on php-config which is in the php-dev package" 
  exit 1
else
  PHP_FD_SIZE=$(${PHP_CONFIG} --configure-options | sed 's/\s\+/\n/g' | grep enable-fd-setsize | sed 's/^--enable-fd-setsize=//' )
  if [[ "${PHP_FD_SIZE}" != "" ]]; then
    if [[ "${PHP_FD_SIZE}" != "${BUILD_FD_SIZE}" ]]; then
      echo "Requested FD No: ${BUILD_FD_SIZE} doesn't equal compiled FD No: ${PHP_FD_SIZE}"
      exit 1
    elif [[ "${PHP_FD_SIZE}" == "${BUILD_FD_SIZE}" ]]; then
Chris Croome's avatar
Chris Croome committed
17
      echo "Requested FD No: ${BUILD_FD_SIZE} equals compiled FD No: ${PHP_FD_SIZE}"
18 19 20 21 22 23 24 25 26 27
      exit 0
    else
      echo "Something has gone wrong, FD No was due to be ${BUILD_FD_SIZE} but it is ${PHP_FD_SIZE}" 
    exit 1
    fi 
  else
    echo "It appears that --enable-fd-setsize was not set when PHP was configured"
    exit 1
  fi
fi