Skip to content
This repository has been archived by the owner on Aug 29, 2020. It is now read-only.

php switch config error #26

Open
visualasparagus opened this issue Apr 3, 2014 · 22 comments
Open

php switch config error #26

visualasparagus opened this issue Apr 3, 2014 · 22 comments
Labels

Comments

@visualasparagus
Copy link

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
Copy link
Owner

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

@Pym
Copy link

Pym commented Apr 17, 2014

Same error here, but with php-5.4.27

@luxifer
Copy link

luxifer commented Apr 17, 2014

Same here

@jubianchi
Copy link
Owner

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

@visualasparagus
Copy link
Author

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
Copy link
Owner

@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 ;)

@jubianchi jubianchi added the bug label Apr 17, 2014
@visualasparagus
Copy link
Author

Any luck?

@buxx
Copy link

buxx commented Apr 24, 2014

@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
Copy link
Owner

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
Copy link

buxx commented Apr 24, 2014

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
Copy link
Owner

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

  • the local .phpswitch.yml was modified by phpswitch commands which is not good given it's a comitted file and it should not changed without explicit user validation
  • the enabled switch for local and/or global PHP was sometimes wrong

The new configuration model should fix everything:

  • a new section has been added to ~/.phpswitch.yml to store local configurations
  • the enabled switch should also be computed correctly, following these rules:
    • if global.enabled and no local phpswitch.yml file is found, then the global version is applied
    • if global.enabled is false and no local phpswitch.yml file is found, then the system default version is applied
    • if global.enabled, a local phpswitch.yml is found and local.enabled then the local version is applied
    • if global.enabled, a local phpswitch.yml is found and local.enabled is false then the global version is applied
    • if global.enabled, a local phpswitch.yml is found and local.enabled is false then the global version is applied
    • if global.enabled is false, a local phpswitch.yml is found and local.enabled is false then the system default version is applied

@buxx
Copy link

buxx commented Apr 25, 2014

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
Copy link
Owner

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

@visualasparagus
Copy link
Author

@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
Copy link
Owner

@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
Copy link
Author

@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
Copy link
Owner

@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
Copy link
Author

@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
Copy link

ping ? i have same here :')

@jubianchi
Copy link
Owner

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

@thehawk970
Copy link

Awesome i am waiting for it :-)

Envoyé de mon iPad

mardi 15 juillet 2014 16:14 +0200 de Julien BIANCHI [email protected]:
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 jubianchi reopened this Jul 16, 2014
@jubianchi
Copy link
Owner

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

jubianchi added a commit that referenced this issue Sep 3, 2014
Should finally close #26 and #19

At least, I hope it will...
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants