gboudreau/Greyhole

View on GitHub
greyhole-php

Summary

Maintainability
Test Coverage
#!/bin/bash

# If you need to override a php.ini directive (like open_basedir), do it in this file.
export PHPRC=/usr/share/greyhole/php.ini

# Check that the required PHP extensions are loaded
function missing_mod
{
    echo "Error: PHP '$1' module missing; please enable it in your PHP configuration."
    rm -f /tmp/greyhole-php.loaded.mods
    exit 1
}
if [ ! -f /tmp/greyhole-php.loaded.mods ]; then
  mods_required="mbstring mysql intl"
  /usr/bin/php -m > /tmp/greyhole-php.loaded.mods
  chmod 666 /tmp/greyhole-php.loaded.mods 2>/dev/null
  for mod in ${mods_required[@]} ; do
      grep "${mod}" /tmp/greyhole-php.loaded.mods >/dev/null || missing_mod "${mod}"
  done
fi

/usr/bin/php "$@"