jubianchi / phpswitch

A CLI utility to help you build and test PHP versions
http://jubianchi.github.io/phpswitch/
MIT License
90 stars 8 forks source link

php switch config error #26

Open visualasparagus opened 10 years ago

visualasparagus commented 10 years ago

I've been trying to install php using phpswitch, however, I'm getting the following error when I try to run

php switch php-5.4.8
[Symfony\Component\Config\Definition\Exception\InvalidConfigurationException]  
Unrecognized options "enabled, mirror" under "phpswitch"                      

I'm running OSX version 10.9.2

jubianchi commented 10 years ago

I'll try to look at this issue ASAP. Thanks for reporting.

Pym commented 10 years ago

Same error here, but with php-5.4.27

luxifer commented 10 years ago

Same here

jubianchi commented 10 years ago

Can someone provide a full stack trace by running with -v flag ? Thanks :)

visualasparagus commented 10 years ago

Sure.

php switch -v php-5.4.8
  [Symfony\Component\Config\Definition\Exception\InvalidConfigurationException]  
  Unrecognized options "enabled, mirror" under "phpswitch"                       

Exception trace:
 () at /usr/share/phpswitch/vendor/symfony/config/Symfony/Component/Config/Definition/ArrayNode.php:316
 Symfony\Component\Config\Definition\ArrayNode->normalizeValue() at /usr/share/phpswitch/vendor/symfony/config/Symfony/Component/Config/Definition/BaseNode.php:268
 Symfony\Component\Config\Definition\BaseNode->normalize() at /usr/share/phpswitch/vendor/symfony/config/Symfony/Component/Config/Definition/Processor.php:33
 Symfony\Component\Config\Definition\Processor->process() at /usr/share/phpswitch/vendor/symfony/config/Symfony/Component/Config/Definition/Processor.php:50
 Symfony\Component\Config\Definition\Processor->processConfiguration() at /usr/share/phpswitch/src/jubianchi/PhpSwitch/Configuration/Validator.php:28
 jubianchi\PhpSwitch\Configuration\Validator->validate() at /usr/share/phpswitch/src/jubianchi/PhpSwitch/Configuration.php:104
 jubianchi\PhpSwitch\Configuration->doRead() at /usr/share/phpswitch/src/jubianchi/PhpSwitch/Configuration.php:152
 jubianchi\PhpSwitch\Configuration->has() at /usr/share/phpswitch/src/jubianchi/PhpSwitch/Configuration/Collection.php:40
 jubianchi\PhpSwitch\Configuration\Collection->get() at /usr/share/phpswitch/src/jubianchi/PhpSwitch/Console/Command/PHP/SwitchCommand.php:54
 jubianchi\PhpSwitch\Console\Command\PHP\SwitchCommand->execute() at /usr/share/phpswitch/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:240
 Symfony\Component\Console\Command\Command->run() at /usr/share/phpswitch/vendor/symfony/console/Symfony/Component/Console/Application.php:193
 Symfony\Component\Console\Application->doRun() at /usr/share/phpswitch/src/jubianchi/PhpSwitch/Console/Application.php:143
 jubianchi\PhpSwitch\Console\Application->doRun() at /usr/share/phpswitch/vendor/symfony/console/Symfony/Component/Console/Application.php:106
 Symfony\Component\Console\Application->run() at /usr/share/phpswitch/src/jubianchi/PhpSwitch/PhpSwitch.php:61
 jubianchi\PhpSwitch\PhpSwitch->run() at /usr/share/phpswitch/bin/phpswitch:26

php:switch [-a|--apache2] [-s|--save] version
php switch [-a|--apache2] [-s|--save] version
jubianchi commented 10 years ago

@visualasparagus Thanks I'm already working on the fix and I have something working in my local branch.

I'll test it a bit more and try to push it asap ;)

visualasparagus commented 10 years ago

Any luck?

buxx commented 10 years ago

@jubianchi Hi, i'm affected to. Waiting your commit impatiently : )

The trace just in case:

php switch -v php-5.4.8

  [Symfony\Component\Config\Definition\Exception\InvalidConfigurationException]  
  Unrecognized options "enabled, mirror" under "phpswitch"                       

Exception trace:
 () at /home/bsevajol/phpswitch/vendor/symfony/config/Symfony/Component/Config/Definition/ArrayNode.php:316
 Symfony\Component\Config\Definition\ArrayNode->normalizeValue() at /home/bsevajol/phpswitch/vendor/symfony/config/Symfony/Component/Config/Definition/BaseNode.php:268
 Symfony\Component\Config\Definition\BaseNode->normalize() at /home/bsevajol/phpswitch/vendor/symfony/config/Symfony/Component/Config/Definition/Processor.php:33
 Symfony\Component\Config\Definition\Processor->process() at /home/bsevajol/phpswitch/vendor/symfony/config/Symfony/Component/Config/Definition/Processor.php:50
 Symfony\Component\Config\Definition\Processor->processConfiguration() at /home/bsevajol/phpswitch/src/jubianchi/PhpSwitch/Configuration/Validator.php:28
 jubianchi\PhpSwitch\Configuration\Validator->validate() at /home/bsevajol/phpswitch/src/jubianchi/PhpSwitch/Configuration.php:104
 jubianchi\PhpSwitch\Configuration->doRead() at /home/bsevajol/phpswitch/src/jubianchi/PhpSwitch/Configuration.php:152
 jubianchi\PhpSwitch\Configuration->has() at /home/bsevajol/phpswitch/src/jubianchi/PhpSwitch/Configuration/Collection.php:40
 jubianchi\PhpSwitch\Configuration\Collection->get() at /home/bsevajol/phpswitch/src/jubianchi/PhpSwitch/Console/Command/PHP/SwitchCommand.php:54
 jubianchi\PhpSwitch\Console\Command\PHP\SwitchCommand->execute() at /home/bsevajol/phpswitch/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:240
 Symfony\Component\Console\Command\Command->run() at /home/bsevajol/phpswitch/vendor/symfony/console/Symfony/Component/Console/Application.php:193
 Symfony\Component\Console\Application->doRun() at /home/bsevajol/phpswitch/src/jubianchi/PhpSwitch/Console/Application.php:143
 jubianchi\PhpSwitch\Console\Application->doRun() at /home/bsevajol/phpswitch/vendor/symfony/console/Symfony/Component/Console/Application.php:106
 Symfony\Component\Console\Application->run() at /home/bsevajol/phpswitch/src/jubianchi/PhpSwitch/PhpSwitch.php:61
 jubianchi\PhpSwitch\PhpSwitch->run() at /home/bsevajol/phpswitch/bin/phpswitch:26

php:switch [-a|--apache2] [-s|--save] version
php switch [-a|--apache2] [-s|--save] version
jubianchi commented 10 years ago

Hi sorry for the delay.

I pushed a branch called configuration which should hopefully fix the issue. Before getting this working you will have to run bin/phpswitch init and source the ~/.phpswitch/.phpswitchrc script as things changed a bit.

Tests are failing on the branch because of the way local and global PHP installation are handled has changed. I'm working on it.

buxx commented 10 years ago

Hi, thank you for your work! I did'nt pull your branch yet: the bug has "disapear". I don't understand ... my terminal has not be closed i've just wait 2 hours.

If the bug appear again i will try to search why and try your branch.

jubianchi commented 10 years ago

@buxx The way PHP versions were managed was not good, it has too many problems:

The new configuration model should fix everything:

buxx commented 10 years ago

But i'm not sure to have correctly use your changes. I've checkout the phpswitch repository and do the phpswitch init, but:

PHP Fatal error:  Uncaught exception 'Symfony\Component\Config\Definition\Exception\InvalidConfigurationException' with message 'Unrecognized options "enabled, mirror" under "phpswitch"' in /home/bsevajol/phpswitch/vendor/symfony/config/Symfony/Component/Config/Definition/ArrayNode.php:316
Stack trace:
#0 /home/bsevajol/phpswitch/vendor/symfony/config/Symfony/Component/Config/Definition/BaseNode.php(268): Symfony\Component\Config\Definition\ArrayNode->normalizeValue(Array)
#1 /home/bsevajol/phpswitch/vendor/symfony/config/Symfony/Component/Config/Definition/Processor.php(33): Symfony\Component\Config\Definition\BaseNode->normalize(Array)
#2 /home/bsevajol/phpswitch/vendor/symfony/config/Symfony/Component/Config/Definition/Processor.php(50): Symfony\Component\Config\Definition\Processor->process(Object(Symfony\Component\Config\Definition\ArrayNode), Array)
#3 /home/bsevajol/phpswitch/src/jubianchi/PhpSwitch/Configuration/Validator.php(28): Symfony\Component\Config\Definition\Processor->processConfiguration(Object(jubianchi\PhpS in /home/bsevajol/phpswitch/vendor/symfony/config/Symfony/Component/Config/Definition/ArrayNode.php on line 316

So i sudo php installer with the installer of your configuration branch to re-install all. And i still have the error. Sorry if i do it wrong !

jubianchi commented 10 years ago

@buxx The installer always uses the defaut branch, which is master. I'll add an option to select another branch.

visualasparagus commented 10 years ago

@jubianchi So I'm not sure how to update to your configuration branch then. I removed everything and reinstalled using the following, but if the installer always pulls master then I guess it's not going to work, right?

curl https://raw.github.com/jubianchi/phpswitch/configuration/bin/installer | sudo php -- --global

Also, when I run phpswitch init it always installs into my home directory and not into /usr/share/phpswitch/ like the docs say.

Thanks again for your work.

jubianchi commented 10 years ago

@visualasparagus The init is always done at a user level, putting everything in the home directory of the user running the initcommand.

I'll make the doc clear on this point.

visualasparagus commented 10 years ago

@jubianchi I've pulled in the configuration branch myself and although I don't get the error, the switch isn't actually working. This is what I did.

cd /usr/share/phpswitch
sudo git fetch origin
sudo git reset --hard origin/configuration
sudo rm -R ~/.phpswitch
sudo rm ~/.phpswitch.yml
source ~/.phpswitch/.phpswitchrc
phpswitch init

the .phpswitch.yml file is never recreated though, which I guess is correct as my installation used --global, right?

phpswitch php:install 5.4.8 --default

But then when I do php switch php-5.4.8 it says it switched but it really doesn't

Global PHP switched to php-5.4.8
PHP 5.4.24 (cli) (built: Jan 19 2014 21:32:15) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

Am I doing something wrong?

jubianchi commented 10 years ago

@visualasparagus You sourced ~/.phpswitch/.phpswitchrc before the phpswitch init when you should have done it after.

Could you try running the switch command in a new, fresh shell (the right version of ~/.phpswitch/.phpswitchrc will be source) ?

visualasparagus commented 10 years ago

@jubianchi I've done that but am having exactly the same problem. It still says it switches, but it doesn't.

Is there anything I can do to help troubleshoot this?

thehawk970 commented 10 years ago

ping ? i have same here :')

jubianchi commented 10 years ago

I'll be on this issue in a few days and hopefully i'll fix it.

thehawk970 commented 10 years ago

Awesome i am waiting for it :-)

Envoyé de mon iPad

mardi 15 juillet 2014 16:14 +0200 de Julien BIANCHI notifications@github.com: I'll be on this issue in a few days and hopefully i'll fix it. — Reply to this email directly or view it on GitHub .

jubianchi commented 10 years ago

Sorry I closed the issue but did not fixed it :/