Skip to content

Error on mediatemple DV #6843

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
purplefish32 opened this issue Jan 22, 2013 · 28 comments
Closed

Error on mediatemple DV #6843

purplefish32 opened this issue Jan 22, 2013 · 28 comments
Labels

Comments

@purplefish32
Copy link

Initially posted here : composer/composer#1505 (comment)

I am trying to install Symfony via Composer on a Mediatemple DV Box where i dont have access to php.ini so I followed this tutorial : http://jamieonsoftware.com/journal/2012/10/4/using-composer-on-gs.html

  1. Installed composer via :
    curl -s https://getcomposer.org/installer | php -d allow_url_fopen=1 -d suhosin.executor.include.whitelist=phar

  2. Aliased composer like so :
    alias composer="php -d memory_limit=512M -d allow_url_fopen=1 -d suhosin.executor.include.whitelist=phar composer.phar"

  3. Composer Install throws this error :

Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap handling the post-install-cmd event terminated with an exception

[RuntimeException]
The php executable could not be found, add it to your PATH environment variable and try again

  1. php -v seems to give me the proper output :

PHP 5.3.15 with Suhosin-Patch (cli) (built: Aug 9 2012 14:28:41)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
with Suhosin v0.9.33, Copyright (c) 2007-2012, by SektionEins GmbH

  1. As per @Seldaek 's recommendation, alias | grep php only outputs :

alias composer='php -d memory_limit=512M -d allow_url_fopen=1 -d suhosin.executor.include.whitelist=phar composer.phar'

@vicb
Copy link
Contributor

vicb commented Jan 23, 2013

@purplefish32 have you tried to "add it to your PATH environment variable and try again" ?

@purplefish32
Copy link
Author

I would love to but unfortunately i dont know how.
Could you point me into the right direction ? I am pretty sure the box is centos based.

@alexandresalome
Copy link

you should package your application with vendors before deploying it on such a machine.

Regarding your PHP installation, when I run php -i | grep '"_"', I get my php binary path:

$ php -i | grep '"_"'
_SERVER["_"] => /usr/bin/php
# When you get it, add it to your path
$ export PATH="$PATH:/usr/bin"

For a fully efficient support, please address to your annoying-machine provider.

@mtDrew
Copy link

mtDrew commented Jan 24, 2013

Hi there purplefish32. I regret not getting to this earlier but it looks like, alexandresalome, beat me to the punch. I recommend following his advice as it should work and is what I would have suggested. In the future, (mt) Media Temple has a great forum over at forums.mediatemple.net that is specific to our hosting. You can also reach us on Twitter 24/7 @MediaTemple. *DJ

@vicb
Copy link
Contributor

vicb commented Jan 25, 2013

@purplefish32 support request are better directed on the Sf user mailing list or directly to mt in such a case. The issue tracker should be reserved for confirmed (or at least highly suspected) issues in Symfony.

@vicb vicb closed this as completed Jan 25, 2013
@purplefish32
Copy link
Author

Sorry I thought it had to do with symfony. For reference the solution provided by @alexandresalome has not worked for me, I will adress the issue directly to mediatemple. Thank you all for your time.

@vicb
Copy link
Contributor

vicb commented Jan 27, 2013

In the end it might be related to symfony but we just don't have enough details to tell.

Donovan Tengblad notifications@github.com wrote:

Sorry I thought it had to do with symfony. For reference the solution
provided by @alexandresalome has not worked for me, I will adress the
issue directly to mediatemple. Thank you all for your time.


Reply to this email directly or view it on GitHub:
#6843 (comment)

@norberttech
Copy link
Contributor

I think I have same problem as @purplefish32
This is what I get after calling php -i | grep '"_"'

SERVER[""] => /usr/local/bin/php53-cli
ENV[""] => /usr/local/bin/php53-cli

How can I force PhpExecutableFinder to get php from above locations?

@norberttech
Copy link
Contributor

@vicb ping :)

@vicb
Copy link
Contributor

vicb commented Mar 28, 2013

I'll check tomorrow on next week, GH current status: "This page is
taking way too long to load."

On 03/28/2013 09:08 PM, Norbert Orzechowicz wrote:

@vicb https://github.com/vicb ping :)


Reply to this email directly or view it on GitHub
#6843 (comment).

@vicb
Copy link
Contributor

vicb commented Mar 29, 2013

@norzechowicz what's your OS ?

@norberttech
Copy link
Contributor

@vicb This is a dedicated OS based at FreeBSD.

@purplefish32
Copy link
Author

@vicb

Not sure 100% what version of linux I am running, but the result for "cat /proc/version" is :

Linux version 3.2.6mtv12 (ci_slave@cislave15.mtsvc.net) (gcc version 4.4.5 (Debian 4.4.5-8) ) #1 SMP Wed Aug 22 03:14:46 PDT 2012

So I guess this is a debian box (MediaTemple DV) if this helps

@vicb
Copy link
Contributor

vicb commented Mar 29, 2013

Could you both execute this on your server (via the server NOT on the cli)

<?php
var_dump(getenv('PHP_PATH'));
var_dump(':');
var_dump(getenv('PHP_PEAR_PHP_BIN'));
var_dump(':');
var_dump(getenv('PHP_BINDIR'));

Together with the path to your php (ie which php in the shell).

One problem I can image is that your PHP is "php53-cli" while we are looking for "php" but that might be a link ?

@norberttech
Copy link
Contributor

Code:

<?php
var_dump(getenv('PHP_PATH'));
var_dump(':');
var_dump(getenv('PHP_PEAR_PHP_BIN'));
var_dump(':');
var_dump(getenv('PHP_BINDIR'));

returns:

bool(false) string(1) ":" bool(false) string(1) ":" bool(false)

which php in shell:

which php
which: no php in (/usr/local/pgsql9/bin:/usr/local/mysql55/bin:/bin:/usr/bin:/usr/local/bin:/usr/local/git/bin)

And yes, the problem is that Symfony is looking for php and I have only php53-cli but I dont have access to create links inside of /usr/bin. Maybe the solution will be possibility to set php executable path somewhere in composer.json?

@lazyhammer
Copy link
Contributor

@norzechowicz Then you could set the PHP_PATH env variable by prepending PHP_PATH=/path/to/php53-cli to your composer alias.

@purplefish32
Copy link
Author

bool(false) string(1) ":" bool(false) string(1) ":" bool(false)

for me too, but I am getting :

/usr/bin/php

as output for which.php

@purplefish32
Copy link
Author

Sorry I just updated composer, seems fixed for me now, moving on to the next bug dammit -> composer/composer#1270

@qcho
Copy link

qcho commented Apr 6, 2013

This issue is still happening, some more information for u all and a workaround

$composer update -v
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Marking symfony/framework-standard-edition (2.2.x-dev) as uninstalled, alias of symfony/framework-standard-edition (dev-master)
  - Marking knplabs/knp-paginator-bundle (2.3.x-dev 8bd7f96) as uninstalled, alias of knplabs/knp-paginator-bundle (dev-master 8bd7f96)
  - Marking doctrine/doctrine-fixtures-bundle (2.1.x-dev 275540d) as uninstalled, alias of doctrine/doctrine-fixtures-bundle (dev-master 275540d)
Generating autoload files
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap handling the post-update-cmd event terminated with an exception



  [RuntimeException]
  The php executable could not be found, add it to your PATH environment variable and try again



Exception trace:
 () at /######################/domains/example.com/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Composer/ScriptHandler.php:204
 Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::getPhp() at /######################/domains/example.com/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Composer/ScriptHandler.php:174
 Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::executeBuildBootstrap() at /######################/domains/example.com/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Composer/ScriptHandler.php:43
 Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap() at phar:///######################/users/.home/bin/composer.phar/src/Composer/Script/EventDispatcher.php:137
 Composer\Script\EventDispatcher->executeEventPhpScript() at phar:///######################/users/.home/bin/composer.phar/src/Composer/Script/EventDispatcher.php:116
 Composer\Script\EventDispatcher->doDispatch() at phar:///######################/users/.home/bin/composer.phar/src/Composer/Script/EventDispatcher.php:89
 Composer\Script\EventDispatcher->dispatchCommandEvent() at phar:///######################/users/.home/bin/composer.phar/src/Composer/Installer.php:281
 Composer\Installer->run() at phar:///######################/users/.home/bin/composer.phar/src/Composer/Command/UpdateCommand.php:102
 Composer\Command\UpdateCommand->execute() at phar:///######################/users/.home/bin/composer.phar/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:240
 Symfony\Component\Console\Command\Command->run() at phar:///######################/users/.home/bin/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:193
 Symfony\Component\Console\Application->doRun() at phar:///######################/users/.home/bin/composer.phar/src/Composer/Console/Application.php:117
 Composer\Console\Application->doRun() at phar:///######################/users/.home/bin/composer.phar/vendor/symfony/console/Symfony/Component/Console/Application.php:106
 Symfony\Component\Console\Application->run() at phar:///######################/users/.home/bin/composer.phar/src/Composer/Console/Application.php:83
 Composer\Console\Application->run() at phar:///######################/users/.home/bin/composer.phar/bin/composer:39
 require() at /######################/users/.home/bin/composer.phar:15

php binary IS in current path as you can see here:

$ whereis php
php: /usr/bin/php /usr/share/php /usr/share/man/man1/php.1.gz
$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

workaround: it seems PhpExecutableFinder::find function is not working in this enviroment (surely will be fixed if you are using php 5.4 since the PHP_BINARY may be available)
You can make it work by exporting the PHP_PATH enviroment variable:
export PHP_PATH=/usr/bin/php

@remedge
Copy link

remedge commented Apr 12, 2013

i am joining to the party - the problem is still exist...

@codeaid
Copy link

codeaid commented May 15, 2013

Add me to this issue too. I'm running it on my Synology NAS but it's still a Linux box so same rules apply.

My PHP executable is in /usr/bin:

/volume1/web $ which php
/usr/bin/php

/volume1/web $ php -v
PHP 5.3.21 (cli) (built: Mar  1 2013 01:21:04) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies

My composer is symlinked: sudo ln -s /volume1/web/composer/composer.phar composer and it works as it should. However, I get the same exception when running composer install from the Symfony directory:

Loading composer repositories with package information
Installing dependencies from lock file
Nothing to install or update
Generating autoload files
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap handling the post-install-cmd event terminated with an exception

  [RuntimeException]                                                                             
  The php executable could not be found, add it to your PATH environment variable and try again  

install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-scripts] [--no-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader]

export PHP_PATH=/usr/bin/php fixes the issue though.

@zergu
Copy link

zergu commented May 15, 2013

I ca also have this problem but only on shared hosting. On my dev machine everything is fine.

$ which php
/usr/local/bin/php
$ echo $PATH
/usr/local/rvm/gems/ruby-1.9.3-p392/bin:/usr/local/rvm/gems/ruby-1.9.3-p392@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p392/bin:/usr/local/rvm/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/mysql/bin:/usr/sbin:/usr/local/pgsql/bin:/usr/local/php/p53/bin

But composer update still leads to:

Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap handling the post-update-cmd event terminated with an exception

  [RuntimeException]                                                                             
  The php executable could not be found, add it to your PATH environment variable and try again

@KeKs0r
Copy link

KeKs0r commented May 28, 2013

Having the same issue on koding.com

@remedge
Copy link

remedge commented Jul 8, 2013

For me, the problem is solved by adding line, which hardly set the PHP_PATH to \vendor\sensio\distribution-bundle\Sensio\Bundle\DistributionBundle\Composer\ScriptHandler.php file:

protected static function getPhp() {
    putenv("PHP_PATH=/usr/bin/php");

    $phpFinder = new PhpExecutableFinder;
        if (!$phpPath = $phpFinder->find()) {
            throw new \RuntimeException('The php executable could not be found, add it to your PATH environment variable and try again');
        }
        return $phpPath;
    }

Obviously, gridserver don't have required variables in system constants. Well, we can set it manualy. Maybe, it could be usefull in other cases.

@sklerotraficon
Copy link

Same for me as @codeaid - On a Synology NAS, where the php executable is located at

/usr/bin 

I get that same error message from Composer.

I tried also - like suggested by @codeaid - to add the path manually via

$ export PATH="$PATH:/usr/bin"

but here to no prevail...

@sklerotraficon
Copy link

Appdx.:
Seems, that the line

export PHP_PATH=/usr/bin/php

has to be added to

/etc/profile

of a Synology Diskstation ( & a reboot) ... the above mentioned error has vanished since!

@csvan
Copy link

csvan commented Jan 10, 2014

Confirming that @codeaid s workaround resolves this issue (for me at least) one MediaTemple GS.

@danielsreichenbach
Copy link

For those using media temple's grid service, the actual solution is a different one. Let me explain what is wrong here first though.

Usually you can edit ~/.profile and add export PHP_PATH="/usr/bin/php", or you can edit ~/.ssh/environment and add PHP_PATH=/usr/bin/php. On media temple's grid service, using custom environment variables when logged in through SSH is not allowed.

So - since I use capifony for deployment - I used a different approach here, and manually added the environment variable to my deployment recipe, using

default_run_options[:env] = { 'PHP_PATH' => '/usr/bin/php' }

Now when I execute cap COMMAND=printenv invoke, the list of environment variables finally includes PHP_PATH, and thus PhpExecutableFinder will succeed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests