Last active
June 9, 2017 07:36
-
-
Save banyan/4715950 to your computer and use it in GitHub Desktop.
This file contains 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
# Worked under these envelopment | |
# | |
# AMI: amzn-ami-pv-2012.09.0.x86_64-ebs (ami-4e6cd34f) | |
# Zone: ap-northeast-1b | |
# Type: m1.large | |
# | |
# CentOS phpenv (https://github.com/CHH/phpenv) system wide installation script | |
# Execute as root user. | |
# Set group to use phpenv: | |
MY_GROUP="" | |
if [ "$MY_GROUP" = "" ] ; then | |
echo '!!! undefined variable MY_GROUP.' | |
echo '!!!' | |
echo '!!! ex.) MY_GROUP=staff phpenv-install-system-wide.sh' | |
echo '!!!' | |
exit 1 | |
fi | |
# Update, upgrade and install development tools: | |
yum -y update | |
yum -y groupinstall "Development Tools" | |
yum -y install readline-devel byacc libxml2-devel gcc httpd-devel openssl-devel curl-devel libjpeg-devel libpng-devel libmcrypt-devel mysql-devel bzip2-devel libc-client-devel libtidy-devel make libxslt-devel git re2c libtool | |
# Install phpenv (actually rbenv): | |
pushd /tmp | |
git clone git://github.com/CHH/phpenv.git | |
cd phpenv/bin/ | |
PHPENV_ROOT=/usr/local/phpenv ./phpenv-install.sh | |
popd | |
chgrp -R $MY_GROUP /usr/local/phpenv | |
chmod -R g+rwxXs /usr/local/phpenv | |
# Add phpenv to the path: | |
echo '# phpenv setup' > /etc/profile.d/phpenv.sh | |
echo 'export RBENV_ROOT=/usr/local/phpenv' >> /etc/profile.d/phpenv.sh | |
echo 'export PATH="$RBENV_ROOT/bin:$PATH"' >> /etc/profile.d/phpenv.sh | |
echo 'eval "$(rbenv init -)"' >> /etc/profile.d/phpenv.sh | |
chmod +x /etc/profile.d/phpenv.sh | |
source /etc/profile.d/phpenv.sh | |
# Install php-build: | |
pushd /tmp | |
git clone git://github.com/CHH/php-build.git | |
cd php-build/ | |
./install.sh | |
popd | |
# Install prefeered version of php-build: | |
php-build 5.4.11 /usr/local/phpenv/versions/5.4.11 | |
phpenv global 5.4.11 | |
# Rehash: | |
phpenv rehash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This works, but this is old in the sense that it uses this method uses both a phpenv to setup an rbenv environment and a php-build tool. The php-build tool uses zips to install versions instead of the php source repository.
You'll be better off trying one of the forks of https://github.com/phpenv/phpenv