Question

I'm trying to set up Symfony 2.5 via Composer. First I am calling:

 php5.3.8-cli /kunden/81425/composer.phar create-project symfony/framework-standard-edition hhcadm/ "2.5.*"

This works until at some point it is internally not calling php5.3.8-cli anymore but somehow uses php. The problem is that php is version 4.4.9 and this causes following effect:

Nothing to install or update
Generating autoload files
Updating the "app/config/parameters.yml" file
X-Powered-By: PHP/4.4.9
Content-type: text/html

<br />
<b>Parse error</b>:  syntax error, unexpected T_STRING, expecting T_CONSTANT_ENCAPSED_STRING or '(' in <b>/kunden/81425/hhcadm/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php</b> on line <b>13</b><br />
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap handling the post-install-cmd event terminated with an exception



  [RuntimeException]
  An error occurred when generating the bootstrap file.

The error makes sense as 4.4.9 is too old. How can I tell Composer/Symfony installer which php installation to use during the install routine?

Same happens for me when I call:

php5.3.8-cli /kunden/81425/composer.phar install

I am pretty shure there must be a config / param for that but I can't find it for hours now.

Thank you very much.

Was it helpful?

Solution

'php' must be the PHP5 executable. The only solution i see is to modify the PATH, launch the composer command (and eventually restore the old path)

For example :

OLDPATH=$PATH
PATH=/usr/local/php5/bin:$PATH
php /kunden/81425/composer.phar install
PATH=$OLDPATH

To help you, you can also create a small script 'composer.sh' :

#!/bin/sh
OLDPATH=$PATH
PATH=/usr/local/php5/bin:$PATH
php /kunden/81425/composer.phar $*
PATH=$OLDPATH

And you call 'composer.sh install'

Edit : if all php binaries are in the same, you can create symbolic links

For example :

mkdir /usr/local/bin/php5
ln -s /usr/local/bin/php53-cli /usr/local/bin/php5/php

And so PATH=$PATH:/usr/local/bin/php5:$PATH

Edit: If you are not allowed to create /usr/local/bin/php5 then just use any other folder like:

#!/bin/sh
OLDPATH=$PATH
PATH=/kunden/81425/php5:$PATH
php /kunden/81425/composer.phar $*
PATH=$OLDPATH
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top