Ошибка «Composer detected issues in your platform: Your Composer dependencies require the following PHP extensions to be installed: mysqli, openssl» (РЕШЕНО)
В данной заметке рассказывается о причинах ошибки и как её исправить.
При самостоятельной установке веб-сервера в Windows, например, по инструкции «Как установить веб-сервер Apache с PHP, MySQL и phpMyAdmin на Windows», при попытке открыть адрес phpMyAdmin может возникнуть ошибка:

В этой ошибке сказано, что «Composer обнаружил проблемы на вашей платформе: ваши зависимости Composer требуют, чтобы были установлены следующие расширения: mysqli, openssl».
Она возникает в последней версии phpMyAdmin (например, в 5.1.1) в следующих случаях:
В файл php.ini не добавлена строка
Откройте файл php.ini и перепроверьте значение директивы extension_dir. В зависимости от папки, куда вы делаете установку, вместо «C:\Server\bin\PHP\ext\» у вас может быть другой путь. Данное значение верно если вы устанавливаете по инструкции, ссылка на которую дана выше.

В файле php.ini не раскомментированы строки:
Перепроверьте файл php.ini, убедившись, что эти строки раскомментированы.

Ваша система по какой-то причине не использует настройки из файла php.ini, например из-за того, что файл php.ini назван неправильно.
Вы можете проверить это, запустив в командной строке:

Вывод должен включать путь к файлу C:\Server\bin\PHP\php.ini. Если это не так, возможно, вы не переименовали файл в php.ini или назвали его php.ini.txt или что-то в этом роде.

Все настройки в файле php.ini сделаны правильно, но веб-сервер не перезапущен, из-за чего настройки не успели примениться.
Чтобы перезагрузить веб-сервер Apache выполните следующую команду (путь до исполнимого файла у вас может быть другой):
Либо перезагрузите компьютер.
Заключение
Можно придумать более экзотические причины, например, при копировании исполнимых файлов PHP не была скопирована папка ext. Но суть всегда одна и та же: PHP не настроен на использование расширений mysqli, openssl — то есть именно то, о чём говорит ошибка.
Куда «копать» в ошибке сервера связанной с композер PHP?
Лег сайт на вордпрессе. Бекапом восстановить не удалось. Это хостер (digitalOcean) что-то обновил у себя или как? Сервер на хостинге свой на ubuntu, если не ошибаюсь.
Он прямо и без намеков пишет:
— Мне нужна версия PHP больше чем 7.2.5 🙂
Так что ставьте последнюю 7.4 и все будет ОК ))
Так что ставьте последнюю 7.4 и все будет ОК ))
А кому именно эта версия новая понадобилась? Моему сайту, серверу. И с чего вдруг?
видимо вордресс обновился и стал требовать версию php выше, откуда там композер я не знаю
вроде как он на восьмой версии работает вполне успешно.
может и работает, но не факт что автор поста обновился до версии где есть поддержка php 8.
Я вообще не вижу смысла ставить 8 если ТОЧНО не знаешь зачем оно тебе нужно.
Совершенно какое-то бессмысленное обновление получилось у них.
Composer PHP Version parsing #7067
Comments
PatrickRose commented Jan 31, 2018
Output of composer diagnose :
1.gbp2e638d PHP binary path: /usr/bin/php7.1 «>
When I run this command:
I get the following output:
1.gbp2e638d) overridden by «config.platform.php» version (7.1) does not satisfy that requirement. «>
It looks like Composer thinks I don’t have PHP 7.1.3 because of my configuration. If I change the composer.json to instead be
The text was updated successfully, but these errors were encountered:
We are unable to convert the task to an issue at this time. Please try again.
The issue was successfully created but we are unable to update the comment at this time.
curry684 commented Jan 31, 2018
I don’t understand the issue?
stof commented Jan 31, 2018
Well, 7.1 does not match the >= 7.1.3, requirement. Composer is totally right. 7.1 is normalized to 7.1.0.0 (composer works with 4 segments internally), which is lower than 7.1.3.0 (the normalized version of 7.1.3 )
PatrickRose commented Jan 31, 2018
stof commented Jan 31, 2018
Any 7.1 patch version is not a version. It is a version range. Composer needs a PHP version for its resolution.
PatrickRose commented Jan 31, 2018
It will never be possible to build a prod environment satisfying both packages.
Can the message be updated to be clearer about what Composer has done?
curry684 commented Jan 31, 2018
I agree the docs example should use 3 digits, but the errors themselves are highly verbose already.
Composer detected issues in your platform: Your Composer dependencies require a PHP version «>= 7.3.0»
I have uploaded my laravel project to aws hosting when I go to ip address of ec2 instance it give me this error
14 Answers 14
add this line in config object of composer.json file
run php artisan config:cache
then run composer dump-autoload in terminal
Project or global composer.json file
Problem:
Your composer checks the platform requirements (PHP version and loaded extensions) when the autoloader is loaded. If you run the application which does not meet the platform requirements, the application will exit with a message similar to this:
Solution:
This worked for me:
Adjust php7.2 to your current module
Note: don’t forget to uncomment the relevant three lines after you switch to the latest version of PHP.
Open cpanel type multiphp Manager, after that select your desired domain and at top right corner change php version to 7.3 or whatever you would like, give it some time and your site will be up and running!
Actually, this was the only solution that worked for me:
@Hashmat Waziri’s answer is right but if anybody want to use your plate form’s version Either Composer require anything, He can set the code depending on his system, in to composer.json file like->
Ignoring is not the right option. What you have to do is upgrading your php version, take into account that by now we already have PHP 8, so with version 7.2 you are far behind.
LINUX USERS Depend on your distros, if you are using a Debian derivative like Ubuntu, use this link guide: https://www.cloudbooklet.com/upgrade-php-version-to-php-7-4-on-ubuntu/ or just google for it and all will be fine.
WINDOWS USERS:
If you are using windows, with Laragon, so all you have to do is download the PHP version that you want from https://www.php.net/downloads.php. Unzip the folder to c:/laragon/bin/php folder and then using Laragon GUI select another version in Menu/php.
If you wish to upgrade the global Windows PHP version, you can use Web Platform Installer https://www.microsoft.com/web/downloads/platform.aspx. This for me was one the easiest way of doing it on windows. For more Information follow these link : https://docs.microsoft.com/en-us/iis/application-frameworks/install-and-configure-php-on-iis/install-and-configure-php
Having used all of the above-attempted solutions, I have found that the one that works best is the following.
I managed to solve this problem by downloading a newer version of PHP that at the same time was compatible with the version of Apache installed from here!. In the Laragon interface, I saw that the Apache version was «httpd 2.4.35 win64 VC15», so I looked for a version of the php that had this «vc15». I downloaded the «php-7.4.19-Win32-vc15-x64» and selected it in my laragon. In this link you can find how to replace the php version in laragon here!
Same problem downgrading from php 8.0 to 7.2 needed to run an older project.
How i have fixed mine issue:
This fixed my problem and allow me to switch between different version without further problems, only requirement is use:
after switching php version to refresh global dependencies.
No clue about what caused the issue, maybe something went funny during php version switch, but we weren’t able to put our finger to the cause of the trouble.
Problem with extensions loaded #8828
Comments
it-can commented Apr 23, 2020 •
Getting errors since PR #8812
I use Laravel Horizon which is producing these errors I think. Their composer.json is here https://github.com/laravel/horizon/blob/4.x/composer.json
All of these extensions are installed. And composer works correct before this commit.
The text was updated successfully, but these errors were encountered:
We are unable to convert the task to an issue at this time. Please try again.
The issue was successfully created but we are unable to update the comment at this time.
it-can commented Apr 23, 2020
@nicolas-grekas can you check this bug?
nicolas-grekas commented Apr 23, 2020 •
it-can commented Apr 23, 2020
1 version installed of php.
stof commented Apr 23, 2020
@it-can even with a single installed version, you can have separate php.ini files for the CLI and PHP-FPM.
it-can commented Apr 23, 2020 •
The PCNTL extension is meant to be restricted to operating in CLI only
Seldaek commented Apr 23, 2020
Maybe we should allow pcntl to be missing in web SAPIs, or even always to keep the checks simple?
That said, the error indicates that imap, intl, pcntl are all missing, so it’s not just about pcntl.
it-can commented Apr 23, 2020
Maybe we should allow pcntl to be missing in web SAPIs, or even always to keep the checks simple?
That said, the error indicates that imap, intl, pcntl are all missing, so it’s not just about pcntl.
The imap, intl were errors on my local machine I see now. My server only nags about pcntl because this is not available in fpm.
Seldaek commented Apr 23, 2020
Ok that’s great to hear. Then we only have to fix pcntl one way or another on our end.
Seldaek commented Apr 23, 2020
Alright you can self-update to latest and it should be fixed after a composer dump-autoload
it-can commented Apr 23, 2020
Alright you can self-update to latest and it should be fixed after a composer dump-autoload
Ok will try and let you know
it-can commented Apr 23, 2020 •
Yes the new version works! Thanks
I seem to know why imap and intl are complaining. I use Deployer for my project to deploy and it sometimes uses the standard Mac os x PHP version, it needs to use my homebrew php version. Thanks for the help
nayomnik commented Jul 11, 2020
In my case I had got a public host. Thus I could only upload folders. So what I ve done on localhost was :
yoeriboven commented Oct 30, 2020
This issue still exists in version 2.0.2.
The issue only shows up in Tinkerwell.
Seldaek commented Oct 30, 2020
dkarlovi commented Oct 30, 2020
Not sure if this is the same issue, seems so.
Seldaek commented Oct 30, 2020
dkarlovi commented Oct 30, 2020
@Seldaek This is likely a special case, I have a build process which prepares the FPM Docker image and in dev I want to keep it close to what it’s on prod, ideally identical. PHPUnit doesn’t get run in there, I use a different image for that (which has those included).
Seldaek commented Oct 30, 2020
Ok yeah that’s fine to ignore that one or even turn off the platform check on your local docker image if needed.. As long as you know what you are doing and running proper checks before deploying.
dkarlovi commented Oct 30, 2020
Yeah, the image is built without these, of course. One consideration might be to add some sort of flag to skip platform check (at least for require-dev) since it’s not exactly the same use case as platform req, latter still being useful in this case.
Seldaek commented Oct 30, 2020 •
dkarlovi commented Oct 31, 2020
@Seldaek I’ve missed that, I guess I can do it globally on my workstation so I never get it in dev, but it’s still there in prod.
qazihamayun commented Nov 4, 2020
This worked for me.
dkarlovi commented Nov 4, 2020
Same here. Did it globally on my workstation, but Dockerfiles still do it without. 👍
foremtehan commented Apr 19, 2021
The issue still exist
I’m on windows machine and cannot install these extension locally:
dkarlovi commented Apr 19, 2021
@Seldaek is it possible to pass platform-check false one-time via the command line, not by changing the config?
Seldaek commented Apr 20, 2021
@foremtehan If the extensions are required, it means the code isn’t going to be running on windows. Or the requirements shouldn’t be there if they are optional IMO.









