Skip to content

Instantly share code, notes, and snippets.

@sbuzonas
Last active January 17, 2016 06:22
Show Gist options
  • Save sbuzonas/8263884 to your computer and use it in GitHub Desktop.
Save sbuzonas/8263884 to your computer and use it in GitHub Desktop.
OpenShift deploy hook to install composer capable of running against php 5.4 with the zend6.1 cart
#!/usr/bin/env bash
GIT_DIR_SAVE=$GIT_DIR ; unset GIT_DIR
GIT_WORK_TREE_SAVE=$GIT_WORK_TREE ; unset GIT_WORK_TREE
if [ ! -f "${OPENSHIFT_DATA_DIR}composer/bin/composer" ]; then
export COMPOSER_HOME="${OPENSHIFT_DATA_DIR}.composer"
echo $COMPOSER_HOME > ${OPENSHIFT_HOMEDIR}.env/user_vars/COMPOSER_HOME
echo "Installing composer"
curl -s https://getcomposer.org/installer | env - PATH="/usr/bin:$PATH" php -- --install-dir=$OPENSHIFT_DATA_DIR >/dev/null
cd $OPENSHIFT_DATA_DIR
git clone --quiet git://github.com/composer/composer.git composer
cd $OPENSHIFT_DATA_DIR/composer
env - PATH="/usr/bin:$PATH" COMPOSER_HOME="$COMPOSER_HOME" php ${OPENSHIFT_DATA_DIR}composer.phar install >/dev/null
mkdir -p $OPENSHIFT_DATA_DIR/bin
ln -s $OPENSHIFT_DATA_DIR/composer/bin/composer $OPENSHIFT_DATA_DIR/bin/composer
else
echo "Updating composer"
cd ${OPENSHIFT_DATA_DIR}composer
git pull --quiet
php ${OPENSHIFT_DATA_DIR}composer/bin/composer install >/dev/null
fi
echo "Running composer install"
cd $OPENSHIFT_REPO_DIR
php $OPENSHIFT_DATA_DIR/bin/composer install
export GIT_DIR=$GIT_DIR_SAVE ; unset GIT_DIR_SAVE
export GIT_WORK_TREE=$GIT_WORK_TREE_SAVE ; unset GIT_WORK_TREE
@sbuzonas
Copy link
Author

sbuzonas commented Jan 5, 2014

After exploring this option I decided the PHP binary compiled for the Zend6 server cartridge had too many features disabled preventing composer from running efficiently.

Essentially you need to use the distro stock php 5.3.3 to do anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment