Symfony2 downgrade bundle to use php 5.6.20 - php

I have a problem with some bundle, i use bundle: vich/uploader-bundle 1.0.1
so my project run only on PHP 7.0 ... how to downgrade some bundle to use PHP 5.6.20 ?
composer install:
Problem 1
Installation request for ocramius/package-versions 1.0.4 -> satisfiable by ocramius/package-versions[1.0.4].
ocramius/package-versions 1.0.4 requires php ~7.0 -> your PHP version (5.6.20) does not satisfy that requirement.
Problem 2
Installation request for ocramius/proxy-manager 2.0.1 -> satisfiable by ocramius/proxy-manager[2.0.1].
ocramius/proxy-manager 2.0.1 requires php ~7.0 -> your PHP version (5.6.20) does not satisfy that requirement.
Problem 3
ocramius/proxy-manager 2.0.1 requires php ~7.0 -> your PHP version (5.6.20) does not satisfy that requirement.
vich/uploader-bundle 1.0.1 requires ocramius/proxy-manager ~1.0|~2.0 -> satisfiable by ocramius/proxy-manager[2.0.1].
Installation request for vich/uploader-bundle 1.0.1 -> satisfiable by vich/uploader-bundle[1.0.1].

In your composer file add the PHP version config key like this:
"config": {
"platform": {
"php": "5.6"
}
},

Related

I have tried to run an existing laravel project. But during composer update I got this error:

Problem 1
- Root composer.json requires gabrielbull/ups-api ^0.8.0 -> satisfiable by gabrielbull/ups-api[0.8.0].
- gabrielbull/ups-api 0.8.0 requires php ^5.5 || ^7.0 -> your php version (8.0.0) does not satisfy that requirement.
Problem 2
- Root composer.json requires mehedi-iitdu/laravel-paystack dev-master -> satisfiable by mehedi-iitdu/laravel-paystack[dev-master].
- mehedi-iitdu/laravel-paystack dev-master requires php ^7.0 -> your php version (8.0.0) does not satisfy that requirement.
Problem 3
- laravel/framework[v5.8.0, ..., 5.8.x-dev] require php ^7.1.3 -> your php version (8.0.0) does not satisfy that requirement.
- Root composer.json requires laravel/framework 5.8.* -> satisfiable by laravel/framework[v5.8.0, ..., 5.8.x-dev].
The error messages are quite clear. The packages you want to install require PHP 7, but you have PHP 8 installed.
Your options are:
Downgrade your PHP version
Upgrade the package versions you depend on, if there are newer PHP 8 compatible versions

Composer & Plesk, encountering PHP version difficulties

Am currently attempting to get my Laravel application running behind Plesk Onyx. Now when trying to run composer install, I get the following error messages:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for doctrine/inflector v1.3.0 -> satisfiable by doctrine/inflector[v1.3.0].
- doctrine/inflector v1.3.0 requires php ^7.1 -> your PHP version (7.0.27) does not satisfy that requirement.
Problem 2
- Installation request for symfony/css-selector v4.0.6 -> satisfiable by symfony/css-selector[v4.0.6].
- symfony/css-selector v4.0.6 requires php ^7.1.3 -> your PHP version (7.0.27) does not satisfy that requirement.
Problem 3
- Installation request for symfony/event-dispatcher v4.0.6 -> satisfiable by symfony/event-dispatcher[v4.0.6].
- symfony/event-dispatcher v4.0.6 requires php ^7.1.3 -> your PHP version (7.0.27) does not satisfy that requirement.
Problem 4
- Installation request for symfony/translation v4.0.6 -> satisfiable by symfony/translation[v4.0.6].
- symfony/translation v4.0.6 requires php ^7.1.3 -> your PHP version (7.0.27) does not satisfy that requirement.
Problem 5
- Installation request for doctrine/instantiator 1.1.0 -> satisfiable by doctrine/instantiator[1.1.0].
- doctrine/instantiator 1.1.0 requires php ^7.1 -> your PHP version (7.0.27) does not satisfy that requirement.
Problem 6
- doctrine/inflector v1.3.0 requires php ^7.1 -> your PHP version (7.0.27) does not satisfy that requirement.
- laravel/framework v5.5.39 requires doctrine/inflector ~1.1 -> satisfiable by doctrine/inflector[v1.3.0].
- Installation request for laravel/framework v5.5.39 -> satisfiable by laravel/framework[v5.5.39].
OK. I understand the errors for sure. I run Debian 9 and "PHP by OS Vendor" is 7.0.27. However, I know that PHP 7.1+ (and even 7.2) is installed on the server, because Plesk'd let me choose (for domains and vhosts) these versions. My question now is: How can I tell composer to use a certain PHP version installed on the server, and how could this work under Debian with Plesk?
Edit: I did not install Composer globally. Just https://getcomposer.org/download/ "Command-line installation".
Here's how:
Find the PHP paths used by Plesk. In my case, this is /opt/plesk/php/. Inside this folder, there are the folders according to PHP versions installed: 7.0, 7.1, 7.2. So php composer.phar install becomes /opt/plesk/php/7.2/bin/php composer.phar install. & it works. :-)
You may use platform setting in composer.json to emulate PHP version:
"config": {
"platform": {
"php": "7.1"
}
},
Composer will assume that PHP version is 7.1 during installation and update, even if you're using 7.0 to actual install.
This will only affect Composer installation and update - if you want to run console commands of your app, you will need to use correct binary (same for web server). However setting this will make your Composer installs and updates more predictable, so it's worth doing it anyway.

What doctrine2 version for PHP 5.6.30

I need to deploy Doctrine on php version 5.6.30. It is possible? If so, how should I set dependencies in composer.json?
Problem 1
- Installation request for doctrine/annotations v1.5.0 -> satisfiable by doctrine/annotations[v1.5.0].
- doctrine/annotations v1.5.0 requires php ^7.1 -> your PHP version (5.6.30) does not satisfy that requirement.
Problem 2
- Installation request for doctrine/cache v1.7.1 -> satisfiable by doctrine/cache[v1.7.1].
- doctrine/cache v1.7.1 requires php ~7.1 -> your PHP version (5.6.30) does not satisfy that requirement.
Problem 3
- Installation request for doctrine/collections v1.5.0 -> satisfiable by doctrine/collections[v1.5.0].
- doctrine/collections v1.5.0 requires php ^7.1 -> your PHP version (5.6.30) does not satisfy that requirement.
Problem 4
- Installation request for doctrine/common v2.8.1 -> satisfiable by doctrine/common[v2.8.1].
- doctrine/common v2.8.1 requires php ~7.1 -> your PHP version (5.6.30) does not satisfy that requirement.
Problem 5
- Installation request for doctrine/dbal v2.6.2 -> satisfiable by doctrine/dbal[v2.6.2].
- doctrine/dbal v2.6.2 requires php ^7.1 -> your PHP version (5.6.30) does not satisfy that requirement.
Problem 6
- Installation request for doctrine/inflector v1.2.0 -> satisfiable by doctrine/inflector[v1.2.0].
- doctrine/inflector v1.2.0 requires php ^7.0 -> your PHP version (5.6.30) does not satisfy that requirement.
Problem 7
- Installation request for twig/twig v2.4.3 -> satisfiable by twig/twig[v2.4.3].
- twig/twig v2.4.3 requires php ^7.0 -> your PHP version (5.6.30) does not satisfy that requirement.
Try removing any Doctrine dependencies from composer.json, delete composer.lock and call composer via CLI:
composer require doctrine/orm
The composer itself will pick best dependencies to match your PHP version.
Delete composer.lock and run composer install help.

Composer: prevent updating packages that require higher PHP version

I'm using the doctrine/dbal (v2.4.*) package in my PHP project. My production server runs PHP v5.6.
I ran composer update this morning which updated my composer.lock file. Now, when I'm deploying to production, I see this:
Problem 1
- Installation request for doctrine/inflector v1.2.0 -> satisfiable by doctrine/inflector[v1.2.0].
- doctrine/inflector v1.2.0 requires php ^7.0 -> your PHP version (5.6.14) does not satisfy that requirement.
Problem 2
- doctrine/inflector v1.2.0 requires php ^7.0 -> your PHP version (5.6.14) does not satisfy that requirement.
- doctrine/common v2.4.3 requires doctrine/inflector 1.* -> satisfiable by doctrine/inflector[v1.2.0].
- Installation request for doctrine/common v2.4.3 -> satisfiable by doctrine/common[v2.4.3].
Specifically these:
doctrine/common v2.4.3 requires doctrine/inflector 1.* -> satisfiable by doctrine/inflector[v1.2.0].
doctrine/inflector v1.2.0 requires php ^7.0 -> your PHP version
(5.6.14) does not satisfy that requirement
This means, that even if dbal is old, it requires the newest common, and common requires the newest inflector package. Problem is that inflector started depending on PHP7 to run.
Is there any way in Composer to limit updating of the packages to those supported by specific PHP version? Like saying: "Please update what you can, but only if the server's PHP version is sufficient."
Use the platform option in your composer.json file to define the PHP version your production environment is using like this:
{
"config": {
"platform": {
"php": "5.6.14"
}
}
}
see https://getcomposer.org/doc/06-config.md#platform
Remove composer.lock file
Run composer install

Installing a specific PHP version with macports

I need to mimic my hosting environment, so composer and symfony would respect the environment.
My host is on PHP 7.0.6
And my local environment is on 7.0.21
During an upgrade doctrine/doctrine-bundle spits out an error
Problem 1
- This package requires php >=7.0.18 but your PHP version (7.0.6) does not satisfy that requirement.
Problem 2
- Installation request for ocramius/proxy-manager 2.0.4 -> satisfiable by ocramius/proxy-manager[2.0.4].
- ocramius/proxy-manager 2.0.4 requires php 7.0.0 - 7.0.5 || ^7.0.7 -> your PHP version (7.0.6) does not satisfy that requirement.
Problem 3
- doctrine/migrations v1.5.0 requires ocramius/proxy-manager ^1.0|^2.0 -> satisfiable by ocramius/proxy-manager[2.0.4].
- doctrine/migrations v1.5.0 requires ocramius/proxy-manager ^1.0|^2.0 -> satisfiable by ocramius/proxy-manager[2.0.4].
- ocramius/proxy-manager 2.0.4 requires php 7.0.0 - 7.0.5 || ^7.0.7 -> your PHP version (7.0.6) does not satisfy that requirement.
- Installation request for doctrine/migrations v1.5.0 -> satisfiable by doctrine/migrations[v1.5.0].
I followed these instructions https://trac.macports.org/wiki/howto/InstallingOlderPort
And tracked the proper version of macports https://github.com/macports/macports-ports/commit/99a636bc52126e82187694ad73c413e22d13f68c
so I ran
git clone --single-branch https://github.com/macports/macports-ports.git
cd macports-ports
git checkout 99a636bc52126e82187694ad73c413e22d13f68c
But I still have the same version of PHP
Any help would be really appreciated.

Categories