Created
September 16, 2012 09:26
-
-
Save STAR-ZERO/3731740 to your computer and use it in GitHub Desktop.
phpenvでapacheモジュール切り替え
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -e | |
| [ -n "$RBENV_DEBUG" ] && set -x | |
| # Provide rbenv completions | |
| if [ "$1" = "--complete" ]; then | |
| echo system | |
| exec rbenv-versions --bare | |
| fi | |
| RBENV_VERSION="$1" | |
| RBENV_ON_FILE="${RBENV_ROOT}/versions" | |
| APACHE_ROOT="/usr/local/Cellar/httpd/2.2.22" | |
| APACHE_MODULE_PATH="${APACHE_ROOT}/libexec" | |
| # Make sure the specified version is installed. | |
| RBENV_PREFIX_PATH="${RBENV_ROOT}/versions/${RBENV_VERSION}" | |
| if [ ! -d "$RBENV_PREFIX_PATH" ]; then | |
| echo "rbenv: version \`${RBENV_VERSION}' not installed" >&2 | |
| exit 1 | |
| fi | |
| PHP_MODULE_PATH="$RBENV_PREFIX_PATH/libphp5.so" | |
| if [ ! -f "$PHP_MODULE_PATH" ]; then | |
| echo "apache module not found \'${PHP_MODULE_PATH}'" >&2 | |
| exit 1 | |
| fi | |
| if [ ! -d "$APACHE_MODULE_PATH" ]; then | |
| echo "Directory not found \'${APACHE_MODULE_PATH}'" >&2 | |
| exit 1 | |
| fi | |
| echo "copy ${PHP_MODULE_PATH} to ${APACHE_MODULE_PATH}" | |
| cp "$PHP_MODULE_PATH" "$APACHE_MODULE_PATH" | |
| echo "Restarting apache..." | |
| sudo apachectl restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment