Asked  11 Months ago    Answers:  5   Viewed   12 times

I am creating a php website using the symfony framework and composer.

  • Operating system: Windows 10
  • PHP version: 7.3.2
  • Symfony: 4.2.3 (env: dev, debug: true)
  • Composer: 1.8.4 (2019-02-11)

When I try to do compose update inside the projects folder or when I try to install a bundle using composer require symfony/swiftmailer-bundle I get the following error:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested PHP extension ext-http * is missing from your system.
      Install or enable PHP's http extension.

(It says 'Problem 1', but it is the only problem listed.)

I already looked for the extension in my php.ini file, but I can't find it. Do I need to install an extension manually? If so, where can I find it?

Thanks in advance!

 Answers

5

The solution is found. For some reason my composer.json contained "ext-http": "*".

"require": {
    "ext-http": "*"
}

Removing this line fixed the problem. I don't know why it contained "ext-http": "*" and I don't fully understand why removing it would fix the problem. (Is it because it is looking for the extension, but can not find it?)

(Thank you to everyone trying to help me fix the problem!)

Update: It might be worth looking at the other answers too. I'm no longer using PHP so I can't check the correctness of these new answers.

Sunday, July 4, 2021
 
EnTee
 
4

I set the PHPRC variable and uncommented zend_extension=php_opcache.dll in php.ini and all works well.

Thursday, April 1, 2021
5

Run composer with the --ignore-platform-reqs option and specify pcntl and posix

composer install --ignore-platform-reqs
Thursday, April 1, 2021
1

As far as I know Flex uses the list of components from the symfony/symfony metapackage, according to the message in your output:

Restricting packages listed in "symfony/symfony" to "4.4.*"

You can find the list of packages in the corresponding composer.json or on packagist:

  • https://packagist.org/packages/symfony/symfony
  • https://github.com/symfony/symfony/blob/master/composer.json#L38-L100

This is the current list for 4.4.1:

symfony/asset: v4.4.1
symfony/amazon-mailer: v4.4.1
symfony/browser-kit: v4.4.1
symfony/cache: v4.4.1
symfony/config: v4.4.1
symfony/console: v4.4.1
symfony/css-selector: v4.4.1
symfony/dependency-injection: v4.4.1
symfony/debug: v4.4.1
symfony/debug-bundle: v4.4.1
symfony/doctrine-bridge: v4.4.1
symfony/dom-crawler: v4.4.1
symfony/dotenv: v4.4.1
symfony/error-handler: v4.4.1
symfony/event-dispatcher: v4.4.1
symfony/expression-language: v4.4.1
symfony/filesystem: v4.4.1
symfony/finder: v4.4.1
symfony/form: v4.4.1
symfony/framework-bundle: v4.4.1
symfony/google-mailer: v4.4.1
symfony/http-client: v4.4.1
symfony/http-foundation: v4.4.1
symfony/http-kernel: v4.4.1
symfony/inflector: v4.4.1
symfony/intl: v4.4.1
symfony/ldap: v4.4.1
symfony/lock: v4.4.1
symfony/mailchimp-mailer: v4.4.1
symfony/mailer: v4.4.1
symfony/mailgun-mailer: v4.4.1
symfony/messenger: v4.4.1
symfony/mime: v4.4.1
symfony/monolog-bridge: v4.4.1
symfony/options-resolver: v4.4.1
symfony/postmark-mailer: v4.4.1
symfony/process: v4.4.1
symfony/property-access: v4.4.1
symfony/property-info: v4.4.1
symfony/proxy-manager-bridge: v4.4.1
symfony/routing: v4.4.1
symfony/security: v4.4.1
symfony/security-core: v4.4.1
symfony/security-csrf: v4.4.1
symfony/security-guard: v4.4.1
symfony/security-http: v4.4.1
symfony/security-bundle: v4.4.1
symfony/sendgrid-mailer: v4.4.1
symfony/serializer: v4.4.1
symfony/stopwatch: v4.4.1
symfony/templating: v4.4.1
symfony/translation: v4.4.1
symfony/twig-bridge: v4.4.1
symfony/twig-bundle: v4.4.1
symfony/validator: v4.4.1
symfony/var-dumper: v4.4.1
symfony/var-exporter: v4.4.1
symfony/web-link: v4.4.1
symfony/web-profiler-bundle: v4.4.1
symfony/web-server-bundle: v4.4.1
symfony/workflow: v4.4.1
symfony/yaml: v4.4.1

As for symfony/monolog-bundle, which is not in the list, it will be installed in a version which does not conflict with other packages. In other words it will be installed in whatever version fits best for Symfony 4.

Saturday, May 29, 2021
 
ariel
 
2

This issue is here:

/**
 * In some special setups, the vendor/ directory isn't located in the project's
 * root directory. To make this command work for every case, read Composer's
 * vendor/ directory location directly from composer.json file.
 *
 * @return string
 */
private function getComposerVendorDir()
{
    $composerJson = json_decode(file_get_contents(__DIR__.'/../composer.json'));
    if (isset($composerJson->config)) {
        return $composerJson->config->{'vendor-dir'};
    }

    return __DIR__.'/../vendor/composer';
}

Specifically:

return $composerJson->config->{'vendor-dir'};

The condition on isset($composerJson->config) returns true, which leads to the above statement. However when you look at the generated composer.json:

"config": {
    "bin-dir": "bin"
},

The vendor-dir is missing. Generating the notice:

PHP Notice:  Undefined property: stdClass::$vendor-dir

Therefore the function returns null, so this requirement fails:

$this->addRequirement(
    is_dir($this->getComposerVendorDir()), // <-- HERE
    'Vendor libraries must be installed',
    'Vendor libraries are missing. Install composer following instructions from <a href="http://getcomposer.org/">http://getcomposer.org/</a>. '.
        'Then run "<strong>php composer.phar install</strong>" to install them.'
);

This is a bug on the symfony/symfony-standard. It's likely it is already in line to be fixed, but you may as well raise it on Github.

EDIT:

It looks like they already have, 2.7 uses:

$this->addRequirement(
    is_dir(__DIR__.'/../vendor/composer'),
    'Vendor libraries must be installed',
    'Vendor libraries are missing. Install composer following instructions from <a href="http://getcomposer.org/">http://getcomposer.org/</a>. '.
    'Then run "<strong>php composer.phar install</strong>" to install them.'
);

There is nothing wrong with your project, its just a bug in the standard edition. So long as you are autoloading classes properly you are fine.

Saturday, December 25, 2021
 
Bala R
 
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :
 
Share