0

I am building a test application on Openshift using the Nginx HHVM 3.13.1, MySQL 5.5 and phpMyAdmin 4.0 cartridges. This is a working application that I have running locally in a vagrant box that uses Composer and has a dependency on Facebook's xhp-lib. This is my current composer.json

{
    "require": 
    {
        "php": ">5.4.0",
        "hhvm": ">=3.6.6",
        "facebook/xhp-lib": "2.x",
        "nikic/fast-route": "dev-master"
    }
}

There are two problems - first, my PHP version isn't current enough, and second, I can't run composer install using the HHVM daemon like so

hhvm composer install

and as a result, all of the dependencies fail with a message saying 'you are running this with PHP and not HHVM' if I explicitly use 'composer install' as the command, and 'hhvm: command not found' if I actually try to run it with hhvm.

This is the post-deploy hook that i'm using, as you can see it literally just tries to download and install composer:

#!/bin/bash

export MY_PHPCOMPOSER=$OPENSHIFT_DATA_DIR/composer.phar

# if composer not exists, download
if [ ! -f $MY_PHPCOMPOSER ]; then
    cd $OPENSHIFT_DATA_DIR
    echo "Downloading composer..."
    curl -s https://getcomposer.org/installer | php -- --install-  dir=$OPENSHIFT_DATA_DIR 
fi

$MY_PHPCOMPOSER -n -q self-update
cd $OPENSHIFT_REPO_DIR   
# install
$MY_PHPCOMPOSER install

So here are my questions: How can I run composer under hhvm in openshift so I can use XHP, and How do I upgrade my PHP version in openshift?

Kenneth Rapp
  • 159
  • 1
  • 9

1 Answers1

0

> How can I run composer under hhvm in openshift?

Running HHVM from a script or the command line seems a bit complicated.

First, hhvm binaries and depended on libraries are at ~/nginx-hhvm/usr/bin and there's a hhvm config file at ~/app-root/runtime/repo/config/hhvm.d/config.ini.

So to run HHVM, let's compose:

LD_LIBRARY_PATH=$OPENSHIFT_PHP_DIR/usr/bin \
    $OPENSHIFT_PHP_DIR/usr/bin/hhvm -c \
        ~/app-root/runtime/repo/config/hhvm.d/config.ini` \
        $OPENSHIFT_DATA_DIR/composer.phar

> How do I upgrade my PHP version in openshift?

Ugh, not easily, you'd have to build it yourself, or build/use a cartridge with newer versions.

m6w6
  • 636
  • 4
  • 8