Closed andrerom closed 6 years ago
Switching between PHP versions when doing testing and this package not knowing when it should not load itself.
The lib has a strict php
constraint
doesn't help, this is composer plugin which is loaded by composer before packages get's updated, so wrong version is used.
One alternative is that you can argue composer should either bluntly delete vendor folder on updates / installs before loading anything. but..
The PHP installation is assumed to be relatively static, and I'd add that the current stable version of PHP is 7.1 already, so I don't think adding an enable/disable flag depending on the current SAT solver is a good idea, as switching environment on the same project should always come with a complete wipe of vendor
for safety.
Even the plugin activation code itself may use 7.2+ features, so it will likely crash before it can even take a decision on its own.
as switching environment on the same project should always come with a complete wipe of vendor for safety.
Actually it's just rm -Rf vendor/ocramius
, everything else is fine ;)
@andrerom you could have a hundred plugins in there: they all activate ;-)
None as aggressively using bleeding edge PHP features, and un-supporting prior PHP versions as often as on packages you are involved in ;)
You can lock onto previous versions of ocramius/package-versions
if you want to support older PHP versions
It's a dependency of my dependencies kind of thing, we don't use it, and don't have it on PHP 5.6 installs.
composer why:
ocramius/proxy-manager 2.2.0 requires ocramius/package-versions (^1.1.3)
And we use proxy-manager for symfony lazy services.
Right, then I suggest using --no-scripts cor operations that may lead to eager dependency autoloading on antiquated PHP versions
On 21 Mar 2018 20:13, "André R." notifications@github.com wrote:
It's a dependency of my dependencies kind of thing, we don't use it, and don't have it on PHP 5.6 installs.
composer why: ocramius/proxy-manager 2.2.0 requires ocramius/package-versions (^1.1.3)
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/Ocramius/PackageVersions/issues/62#issuecomment-375063225, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJakOMe5N3Cwou_s4rn6gkuveMFAb-Zks5tgqZsgaJpZM4SzoA4 .
Need help..
After successfully installed composer 1.7.1, when do a 'php composer.phar', I have the following error: Parse error: parse error, expecting ';'' or
'{'' in /Users/user name/.composer/vendor/ocramius/package-versions/src/PackageVersions/Installer.php on line 59.
Have removed and reinstalled older versions composer, still have the same error. Please someone could let me know how can I fix this and get the composer working again? Is there a way to start a fresh install if I have to?
Upgrade your PHP version and it should be alright
I updated PHP to 7.2.7, MAMP 5.0.1 along with composer to 1.7.1 then I have this error. I am now back to MAMP 3.5, PHP 5.6.10 but still have the same error!
What's the output of php -v
?
PHP 5.5.38 (cli) (built: Oct 29 2017 20:49:07) . I installed composer 1.5.0 which didn't work.
Yeah, so upgrade it so that it says PHP 7.2.x
(current stable) and you should be fine :)
I ran this: curl -s https://php-osx.liip.ch/install.sh | bash -s 7.2
Saw the following:
Installing package 7.2-10.10-frontenddev into root /
Package 7.2-10.10-frontenddev is already installed at version 7.2.7-20180623-112258. You wanted to install version 7.2.7-20180623-112258.
Finished.
Also installed composer and saw: Composer (version 1.7.1) successfully installed to:
Then did: php composer.phar and saw the error:
Parse error: parse error, expecting ';'' or
'{'' in /Users/Corbett Lyon/.composer/vendor/ocramius/package-versions/src/PackageVersions/Installer.php on line 59
check again php -v it is still showing: PHP 5.5.38 (cli) (built: Oct 29 2017 20:49:07)
What went wrong?
This is most likely because the php
you have in your $PATH
is different from the one by Liip
Check the output of which php
and you will see what it resolves to. Adding a symlink to the actual PHP installation you want in /usr/local/bin/
is generally solving this, as it "shadows" the other installation (presumably what comes with MacOS).
Did a PATH=/usr/local/php5/bin:$PATH, then I can see php -v is 5.6.36 now but yet to figure out how to add a symlink as you said. Will update you on this. Thanks for your help so far!
@Allegro145 If you ever downgrade PHP, like for instance if you have several PHP's installed in order to switch between projects.
Then if you on purpose want to run composer with older PHP then what has been used before on a project, then just run rm -Rf vendor/ocramius
OR otherwise remove whole vendor/
before you run composer install
or composer update
to get the right package versions for your PHP version.
Not sure if you need it, but here is a liip
script for switching between liip php versions:
https://gist.github.com/andrerom/b360a1b2dbbebc6ec1861b8618d64e97
@andrerom & @Ocramius I have a project works with PHP 5.6 & MAMP 3.5. I want to test if it will work with PHP 7.2. I installed the PHP 7.2 and composer 1.7 but messed it all up and got those errors. I am now trying to get a clean install of PHP and composer (outside the MAMP), no matter which version as long as they work. But no luck, currently 'php -v' is 5.6.36 and 'phpinfo.php' is 5.6.10. So composer 1.7 just doesn't work (same error as always).
I did 'rm -Rf vendor' then install composer 1.7, still no luck.
Ran a 'which php' is /usr/local/php5/bin/php and these two lines are in my ~/.bash_profile: alias phpmamp='/Applications/MAMP/bin/php/php5.5.10/bin/php' export PATH=/usr/local/php5/bin:$PATH
Can you see what have I done wrong or how should I fix this?
But no luck, currently 'php -v' is 5.6.36 and 'phpinfo.php' is 5.6.10.
Fixing this is going to fix your issues: 5.6 is extremely outdated, and you should move away from it regardless.
I have no idea how to fix MAMP, which is a separate project, but that's not an issue to be solved by this project.
Try putting your PHP 7.x path before the MAMP one in $PATH
.
Locking the thread here: we went hugely off-topic.
Reason: Switching between PHP versions when doing testing and this package not knowing when it should not load itself.
So improvment request: Please add some sanity check for php version running before loading plugin code to avoid this.