I have a Symfony 3.0 application that I want to deploy on cloudControl. The app is running on the pinky stack; my composer.json requires PHP >=5.5.9
"require": {
"php": ">=5.5.9",
...
}
When I try to push, I get
...
-----> WARN: No php version found in composer.json. Falling back to legacy build.
...
Your requirements could not be resolved to an installable set of packages.
Problem 1
- This package requires php >=5.5.9 but your PHP version (5.4.45) does
not satisfy that requirement.
The phpinfo() of the pinky stack shows, that PHP 5.6.12 is running.
How do I have to modify my composer.json (or any other file in my application) to make this run in PHP 5.6?
There is a blog post, about how to use specific PHP versions and extensions.
http://www.paasfinder.com/custom-php-version/
Since all systems are 64bit, you have to use e.g.:
{
"require": {
"php-64bit": "5.6.12"
}
}
Related
I have this file directory:
When I open this project in browser: Fatal error: Class 'Phalcon\Mvc\Application' not found in...
I read that I have to install composer but when I install composer this errors occure:
How can I run my project?
My composer.json file consists:
"require": {
"phalcon/incubator-mailer": "^1.0",
"smi2/phpclickhouse": "^1.4",
"hybridauth/hybridauth": "^3.8"
}
}```
There are in fact two problems.
You are missing the phalcon php extension. You can find the instructions on how to install the extension in the official Phalcon documentation.
You need at least php version 7.3 to satisfy the requirements of smi2/phpclickhouse. Since php 7.x is EOL since 26th of November 2022, I'd strongly suggest to upgrade to the latest version which currently is php 8.1.
Once you resolved the two problems, composer install should run successfully, and the missing classes should be placed in the vendor directory.
Following up on some of the other comments, Phalcon 4 is NOT compatible with PHP 8.1. Phalcon 4 requires PHP 7.4.
If you plan on running PHP 8.1, you will need to install Phalcon 5.1.1.
You can find the Phalcon installation documentation on at https://phalcon.io
I have already successfully deployed the app in php standard 7.4 environment and its running, today i wanted to update it and when i do gcloud app deploy i get:
Problem 1
- Root composer.json requires PHP extension ext-mongodb * but it is missing from your system. Install or enable PHP's mongodb extension.
Problem 2
- mongodb/mongodb is locked to version 1.4.0 and an update of this package was not requested.
- mongodb/mongodb 1.4.0 requires ext-mongodb ^1.5.0 -> it is missing from your system. Install or enable PHP's mongodb extension.
So i checked the php.ini file for the deployment, its in the root folder (same level as the yaml file) and contains:
extension=mongodb.so
extension=redis.so
extension=igbinary.so
Did i missed any google cloud update? I am wondering cause it does not complain about the version of the mongodb php extension and just says there is no extension?
I also tried to switch to PHP 8.1 runtime but i got the same error.
"provide" : {
"ext-mongo": "*"
},
i was able to fix it by adding this to my composer.json .. somehow i never needed it until today.
Worked for me adding to composer.json, so ext-mongodb instead of ext-mongo (I cannot comment on the answer of user1334817 )
"provide" : {
"ext-mongodb": "*"
}
This question already has answers here:
Reference - Composer error "Your PHP version does not satisfy requirements" after upgrading PHP
(3 answers)
Closed 1 year ago.
We are starting to use PHP 8 on new projects. But we are also migrating old projects to the new PHP 8. Problems occur when installing dependencies.
Because PHP 8 is relatively new, there are still many third-party packages that depend on older versions of PHP (mostly only due to outdated configuration).
My PHP version:
martin#empire:~$ php -v
PHP 8.0.3 (cli) (built: Mar 5 2021 07:54:13) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.3, Copyright (c) Zend Technologies
with Zend OPcache v8.0.3, Copyright (c), by Zend Technologies
Example of composer install on Symfony project:
martin#empire:~/projects/twig-example$ composer install
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Your lock file does not contain a compatible set of packages. Please run composer update.
Problem 1
- twig/twig is locked to version v2.3.0 and an update of this package was not requested.
- twig/twig v2.3.0 requires php ^7.0 -> your php version (8.0.3) does not satisfy that requirement.
Problem 2
- twig/twig v2.3.0 requires php ^7.0 -> your php version (8.0.3) does not satisfy that requirement.
...
Example composer update on Laravel 8 project:
martin#empire:~/projects/collabquest-api$ composer update
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- jwilsson/spotify-web-api-php[3.6.0, ..., 3.6.2] require php ^7.0 -> your php version (8.0.3) does not satisfy that requirement.
- Root composer.json requires jwilsson/spotify-web-api-php ^3.6 -> satisfiable by jwilsson/spotify-web-api-php[3.6.0, 3.6.1, 3.6.2].
What is the best way to deal with this issue and solve this dependency problem?
Update:
Definitive solution
Use newer packages that are PHP 8 ready. Most packages are up to date.
If some explicitly require lower versions of PHP, find a replacement. Or fork them and update.
You can use the following as a temporary solution:
Temporary quick solution
Composer has the following possibilities:
--ignore-platform-req=IGNORE-PLATFORM-REQ Ignore a specific platform requirement (php & ext- packages). (multiple values allowed)
--ignore-platform-reqs Ignore all platform requirements (php & ext- packages).
Usage:
# for composer install
composer --ignore-platform-req=php install
# for composer update
composer --ignore-platform-req=php update
# also works for require etc.
Most packages use PHP version 7.x.x or lower, which is backward compatible with version 8. So no issue should arise.
Update: There is also the possibility of forcing the version directly in the composer.json. However, this option was not usable for us, because we have already used a special syntax and features of php version 8 in the code. Even so, we already had version conflicts, whether we forced version 7 or 8 of PHP to the project.
Example of forcing version in composer.json:
{
"config": {
"platform": {
"php": "7.0.0"
}
}
}
Use it only when you are sure that it does not cause any problems.
downgrade your php version until packages that depend on it make an update ,
or you must replace it with another,
I have the same problem and I used the first solution.
We are using PHPCI and composer. The server which runs PHPCI is on PHP 5.3.
For a project we added the Facebook PHP SDK, using composer. It requires PHP 5.4.
Composer gets triggered by PHPCI and get executed. But because the CI server just got PHP 5.3 composer failed with the error message:
facebook/php-sdk-v4 4.0.9 requires php >=5.4.0 -> no matching package found.
This let fail my build in PHPCI, of course.
Is there a possibility to skip this requirement? Maybe by adding an option to composer.json? Or a parameter to composer.phar call?
I've found the option:
composer install --ignore-platform-reqs
Ignore platform requirements (php & ext- packages).
Alternative: Specify your projects' PHP version
You can skip the platform checks by configuring composer.json#/config/platform/php with the PHP version to use.
Composer will fetch packages based on that configured PHP version then.
So when you need to tell Composer the PHP version for your projects dependencies, you can (and should) specify the PHP version if different than the PHP version you execute composer with in your composer.json project configuration file (AKA root package):
{
"config": {
"platform": {
"php": "5.6.6"
}
}
}
Here PHP 5.6.6 version is exemplary, it could be 8.0.4 or any other PHP version.
This also documents the target (platform) PHP configuration. Additionally installed PHP extensions and library versions can be specified.
Compare: Config: platform - Composer documentation
For many commands, you can tell composer to bypass php version check, with parameter "--ignore-platform-reqs":
composer COMMAND --ignore-platform-reqs
this will bypass php version specification.
Be aware that the software may work or not: php version specification is there because somewhere in the code is needed at least the specified php version, so if you use that code the software will break.
If anything requires a specific version of PHP, it won't run in a lower version of PHP. You will properbly still recieve errors when bypassing the PHP requirement.
Btw, PHP 5.3 is no longer maintained, I would strongly recommend updating the PHPCI server.
I want to install zend framework on the Ubuntu and i have followed the instruction of installation from
http://framework.zend.com/manual/2.2/en/user-guide/skeleton-application.html
link but failed to install.
I have downloaded the ZendSkeletonApplication from here
https://github.com/zendframework/ZendSkeletonApplication
After that run of this command
php composer.phar self-update // it's working
But after the first command the second Command
php composer.phar install // Not working
And showing this error
Loading composer repositories with package information
Installing dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- zendframework/zendframework 2.3.1 requires php >=5.3.23 -> no matching package found.
- zendframework/zendframework 2.3.0 requires php >=5.3.23 -> no matching package found.
- Installation request for zendframework/zendframework 2.3.* -> satisfiable by zendframework/zendframework[2.3.0, 2.3.1].
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.
Update after some comments:
Now I've downloaded the ZendSkeletonApplication-master and move the
Library folder of ZendFramework-2.3.1
in the
ZendSkeletonApplication-master/vendor/ZF2/
But after that when i access this i'm getting this error on the page
ZendSkeletonApplication-master/public/index.php // in the browser it showing me this error
Fatal error: Declaration of Zend\Stdlib\ArrayObject::offsetGet() must be compatible with
that of ArrayAccess::offsetGet() in /var/www/html/demo/username/ZendSkeletonApplication
-master/vendor/ZF2/library/Zend/Stdlib/ArrayObject.php on line 22
Well two solutions are possible :
First upgrade php, However it could be possible that Ubuntu release on your system not having upgrades for php. So in that case search google to add APT repository for php 5.3.23 for your ubuntu-VERSION.
Second I personally experienced that, Checkout in folder you will found composer.json file, In that file you will get the settings something like
"require": {
"php": ">=5.3.23",
"zendframework/zendframework": "2.3.*"
}
Just change settings to get other version of ZF2
"require": {
"php": ">=5.3.3",
"zendframework/zendframework": "2.2.*"
}
It works for me. It should work for you.
Read the error, the main thing we need to focus on is this:
zendframework/zendframework 2.3.1 requires php >=5.3.23 -> no matching package found.
I'll break it down for you.
This states that the package you are attempting to install(zendframework/zendframework 2.3.1) REQUIRES a php version GREATER OR EQUAL TO 5.3.23. As your php -v output stated, you are running PHP 5.3.10. If you are running on a local server that you have access to updating the php version, then update php and run it again, you should see that it works fine. If you are on a remote server, contact your hosting company and see if they can upgrade you to a newer version of php and then run it again!
Hope this helps!
If you have more then one version of php installed and you have php environment variable linking to an old php executable then you may get this issue. Change your environment variable to the php you want to use.