I am at my wits end:
In my PLESK panel PHP is set to 7.2
In the CLI the output of php -v is: PHP 7.1.26 (cli)(built: Jan 11 2019 11:47:41)( NTS )
but when I run: composer require guzzlehttp/guzzle
This is the error
guzzlehttp/promises v1.3.1 requires php >=5.5.0 -> your PHP version (5.4.45) does not satisfy that requirement.
I even when as far as removing all other PHP version in PLESK
You say that you can change the PHP Settings in PLESK, that is commonly an example of a Multi PHP webserver.
That is very popular these days, but also there is something dangerous about it. When the website may run fine on it. The real problems is that there are two seperate PHP installations
The most legit situation is that your hosting provider installed Composer on PHP 5.4.45 and added PHP 7.+ after it.
Result: Composer will only work with PHP 5
You can see it as two seperate executable files (just for example, this is not the exact situation)
PHP 5: /usr/bin/php
PHP 7: /usr/bin/php7
There is one thing you can do right know. Do to the fact that PHP5 is the main PHP installation, I advise you to ask your hosting provider to reinstall Composer on PHP7
Note: Removing a PHP version in Plesk does not removes it also on the Operating System.
Related
I get the following error when running mPDF in my browser. I have just installed the latest version of mPDF on my cloud server running PHP 7.4. The requirements page for mPDF say I should be able to run this version with PHP 7.3+
I have tried to resolve the issue in composer.json but have no success. I am not able to install PHP 8.0 without upgrading the hosting which I do not want to do.
Any direction is appreciated.
Error message:
Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.0.0".
If you would like to learn why the php package is required (this may sound stupid, but think about it as a requirement with a specific version), you can make use of composer-depends(1), a.k.a. why?:
$ composer why php
...
composer/semver 3.2.6 requires php (^5.3.2 || ^7.0 || ^8.0)
doctrine/annotations 1.13.2 requires php (^7.1 || ^8.0)
...
It gives an alphabetical listing of packages in your configuration and which php version they require. This should help you to spot which package requires ^8.0.0 / >= 8.0.0 to get a better understanding.
When your target platform has PHP 7.4, you can configure your project to always depend on that version. This works by specifying the platform php version as a configuration option.
Get the exact php version on your target platform, e.g. 7.4.30 (Aug 2022).
Note: PHP 7.4.x is going to end of life this year[1], consider upgrading the hosting within the next two months to 8.0 at least (if changing hosting for the PHP version is hard, consider to already go to 8.1, test your project with each version first thought, best done locally).
Then within your project configure that version as the projects target platform version:
$ composer config platform.php 7.4.30 # (1.)
# (no output)
1. replace the exemplary version 7.4.30 with your target platform version
After changing the Composer project configuration this way, you need to update the projects dependencies:
$ composer update
# ...
Now Composer will no longer infer the available version of the php platform package (the PHP version) from the environment but instead take the configured platform version. Your local PHP version is not interfering any longer to resolve the installable set of packages. Instead, the configured platform PHP version is used for the resolution.
This effectively prevents that you pull in packages that require a higher PHP version.
Commit all changes to the configuration (composer.json) and pinned versions (composer.lock) and use those to do the packaging for the deployment to the target platform.
I am trying to install a library https://github.com/thephpleague/csv via composer but getting following errors i.e
'This package requires php >= 5.5.9 but your php version <5.4.45> does not satisfy that requirement.'
My current PHP version is 5.6.30 but for some reason composer is showing <5.4.45> which is strange.
I am using ACQUIA DEV DESKTOP on WINDOWS and can switch between PHP versions easily and can check PHP version either by a) dpm(phpinfo()); or b) drush php which is showing same version as set in ACQUIA DEV DESKTOP.
This leads to an issue linked with the composer as it's reading a wrong PHP version.
Steps I have followed to install this library i.e
Copied composer.phar file from 'DevDesktop/tools' folder onto my Drupal project root and then via drush used 'composer require league/csv' which gives me this error ....
'This package requires php >= 5.5.9 but your php version <5.4.45> does not satisfy that requirement.'
'drush php' gives me this... 'Psy Shell v0.8.3 by Justin Jileman'
I have checked online resources for the similar errors but none of the solution out there matches my situation hence posting this question.
Not sure if this is linked to the issue but I have noticed 'DevDesktop\tools\drush.bat' have first line i.e
IF "%PHP_ID%"=="" (SET PHP_ID=php5_5)
which I changed to
IF "%PHP_ID%"=="" (SET PHP_ID=php5_6)
Stack stop/start and tried to download 'composer require lease/csv' but no change (same results).
Thanks in advance.
Found a solution for this error and wanted to share so as it helps anyone else having same problem and possibly improve the solution as it seems to be a quick fix while it should be a universal fix :)
If you install Acquia DevDesktop software, composer comes with this by default.
From Acquia DevDesktop software, we can easily switch between php versions and can also set a default php version but that was not helpful when I try to download library via composer which kept on reading version 5.4.
As Acquia DevDesktop supports different PHP versions i.e 5.3, 5.4, 5.5, 5.6, 7. By default composer was reading php version 5.4 and I still need to find the file which needs to be modified so as default php version can be changed for composer.
In my case what I did was...
Go to Program Files > DevDesktop > tools folder.
There are 4 files having different extensions but same name i.e 'composer'. Remove these all files will remove composer from your system.
Download composer.exe from https://getcomposer.org/ and give it a target folder i.e 'Program Files > DevDesktop > php5_6' and install.
Once installed, now go to your project and by using command prompt or drush console, type 'composer require league/csv' which should download all files in your projects 'vendor' folder.
I have to install ZF2 on Windows:
I've clone ZendSkeletonApplication (ZSA) repository from Git
Open cmd and get in ZSA folder
run php composer.phar self-update (everything is ok)
run php composer.phar install
And now I get this:
zendframework/zendframework 2.3.1 requires php >=5.3.23 -> no matching package found.
Okay, I've checked php version php -v:
PHP 5.3.6 (cli) (built: Mar 17 2011 10:37:07)
Any ideas?
ZF 2.3.0 and above requires PHP 5.3.23 or above. You have 5.3.6 (6 is less than 23!). You either need to upgrade PHP to a more recent version, or downgrade to ZF 2.2.x.
5.3.6 is less than 5.3.23. >= means "greather than or equal to".
Zend Framework 2 requires at least 5.3.23, while you have 5.3.6. That means your PHP version is not supported, you can't use the Zend Framework on that server.
What you can do:
Update PHP version to something newer (5.3 is getting pretty old)
If you are sure you already have a newer PHP version installed, check that the cmd is using the new PHP binary and not the old one.
I suggest you update your local Windows version of PHP to the version you are using in production. If that production version is not able to run Zend Framework 2.3.1, you'd not benefit from solving the dependency problem you are experiencing.
Composer does not allow you to change the internally used PHP version if your local PHP is simply used to put together all dependencies but to used to execute these. So matching the production version is a good thing.
Documenting my struggles to help others and hopefully get some feedback on how I could have done it better.
The command pecl install pthreads fails due to the php installed on my ubuntu 13.04 box not having zts configured.
Options:
1) The ubuntu respository does not have a php package with zts enabled. As of this post, ubuntu only has php 5.4.9 in it's repository (Released: 22 Nov 2012). It is possible to compile a php version from source - which I eventually did (see below), but..
2) I .. ALSO .. wanted to use phpfarm for the ability to run different versions of PHP on my local setup. On github, there is Christian Weiske's original contribution here (phpfarm) and a fork that he has contributed to, by François Poirotte - also called phpfarm. Francois' fork has a few more options to configure ('post-install customization') but I was not able to make that work with a PECL extension. I'm curious to know if misunderstood how to do that, because it looks to me that it just simply does not take PECL commands.
3). Prior to recompiling php from source, I loaded phpfarm (tried both versions), enabled php-fpm (FastCGI) and was able to get my apache2 server to use a phpfarm version (5.5.10) which showed up in a phpinfo() output. But the php-cli always showed the original php version (5.4.9) in the cli (run: php -v). Running (run: php -i | grep php.ini) showed /etc/php5/cli but I had previously removed php5 and aptitude show php5 returned a state of 'not installed.' I even renamed the /etc/php5 directory to see if I could force the system to use the phpfarm php version. Obviously, this is incorrect thinking and I went on to simply compile php 5.6 from source. But, is there something more to do to get a phpfarm php to be used in the cli? I read that the cli loads it's configuration file on a per command basis, unlike the apache2. If I could have run the 5.5.10 version (configured with zts) then I could have then done pecl install pthreads and then re-complied the phpfarm 5.5.10 version with pthreads enabled. Although it appears I will be able to run various versions of php in the apache server, will I ever be able to switch-phpfarm to another version and see it working in the php-cli? Also, I was uncertain on where I could have loaded a pthreads file for the phpfarm compile process to find and use it; could I have done it that way?
4) This stackoverflow post, essentially posted by Joe Watkins - the developer of pThreads is a perfect how-to on getting pThreads installed on a Ubuntu system that has had php configured with zts (Zend Thread Safety). (Thanks Joe!)
A nice tutorial on using phpfarm configured with fast-cgi and the apache server to help run websites under different php configurations.
So what gives with php, php-cli and the phpfarm?
I'm not sure about phpfarm, but do know of another solution ...
Multi
A tool for maintaining multiple installations of PHP in multiple configurations
https://github.com/datingvip/multi
This is a bit more user orientated, will allow you to build many configurations and versions of php, any tagged release of php, and any patched version from any fork of php-src.
In addition, because I wrote it, it will install pthreads for you.
git clone https://github.com/datingvip/multi
cd multi
VERSION=5.5.10 DBG=no-debug ZTS=zts ./php.multi
The above commands will yield an installation of PHP (in one suitable configuration, of one version) in /opt/php.
Look at php.defaults for configuration options and adjust before building
Should configuration fail on, for example, something related to a library like libxml2, it will usually be the case that
sudo apt-get install library-dev
Where library is replaced with the name of the library holding up the build, will fix the problem for you. If it does not, a quick google should get you going again.
Once the build is complete
source /path/to/multi/php.env 5.5.10
Note: multi will always install pthreads for any zts version automatically
I hope that gets you somewhere ...
I know that the Laravel 4 requirements are PHP >= 5.3.7 but my client must recent application server only has PHP 5.3.3. Yes, three years old version...
I need more arguments to explain the situation and find a solution with him (no move, upgrade or cloud hosting).
The questions are the following :
Can I make L4 run with PHP 5.3.3 ?
If not, why ?
If so, how and with what limitations ?
[EDIT] What I know about my client configuration is : Red Hat Enterprise Linux 6.3 on VMWare virtual machine with Apache 2.2 and PHP 5.3.3.
Laravel 4 requires PHP 5.3.7 due to using the bcrypt algorithm when hashing passwords, which received a huge bugfix at that version.
Have a look at this article for bringing the requirement of PHP for Laravel 4 down to 5.3.2: http://laravel.io/topic/39/laravel-4-easily-extended
EDIT: here is an archived version of the linked article, as the original appears to be down:
https://web.archive.org/web/20130805153640/http://laravel.io/topic/39/laravel-4-easily-extended
NOTE: some PHP versions of 5.3.3 on certain distros do have the bcrypt algorithm fix backported into them, such as RedHat. You can read on how you can test if the distro you are using is one of them here; if it is, your distro supports the fix, and in turn supports Laravel 4 out of the box.
I had an experience with a remote webhost that offers several versions of php, and somehow, was set to an older default version of php.
For example, I could not figure out why my migrations would not run - artisan commands failed for no apparent reason, when a nearly identical local setup worked. Come to find out that my root folder was set to 5.2 something. A quick chat session with the webhost guys, and they showed me how to fix. Presto- migrations work.
Much of the rest of my application worked, but the artisan functionality is a no-can-do-without for me. Hope that helps.
Also, the built-in php development web server is handy - starts with 5.4.
EDIT: Here is a little more ammo for you: another specific issue I encountered:
root#Grisbuntu:/home/ryan/MyApp6# php /usr/bin/composer.phar update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- zizaco/entrust dev-master requires php >=5.4.0 -> no matching package found.
...
root#Grisbuntu:/home/ryan/MyApp6# php -v
PHP 5.3.10-1ubuntu3.6 with Suhosin-Patch (cli) (built: Mar 11 2013 14:31:48)
So there you have it: Entrust is one specific example of a package you cannot use without 5.4....
sudo add-apt-repository ppa:ondrej/php5
sudo apt-get update
sudo apt-get install php5
php -v
...PHP 5.4.15-1~precise+1 (cli) (built: May 13 2013 16:00:00)
composer update
...
I hope that helps someone!
UPDATE: July 2013, per php.net : Please Note: This will be the last regular release of the PHP 5.3 series. All users of PHP are encouraged to upgrade to PHP 5.4 or PHP 5.5. The PHP 5.3 series will receive only security fixes for the next year.