Viewed   148 times

I am trying to add HWIOAuthBundle to my project by running the below command.

composer require hwi/oauth-bundle php-http/guzzle6-adapter php-http/httplug-bundle

HWIOAuthBundle github: https://github.com/hwi/HWIOAuthBundle

When I try to run composer require I am getting the out of memory error.

Using version ^[email protected] for hwi/oauth-bundle Using version ^[email protected] for php-http/guzzle6-adapter Using version ^[email protected] for php-http/httplug-bundle ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev)

PHP Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 67108864 bytes) in phar:///usr/local/Cellar/composer/1.4.2/libexec/composer.phar/src/Composer/DependencyResolver/Solver.php on line 220

Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 67108864 bytes) in phar:///usr/local/Cellar/composer/1.4.2/libexec/composer.phar/src/Composer/DependencyResolver/Solver.php on line 220

I tried setting the memory_limit to 2G in my php.ini file but did not work. I found my php.ini by running php -i | grep php.ini

 Answers

4

To get the current memory_limit value, run:

php -r "echo ini_get('memory_limit').PHP_EOL;"

Try increasing the limit in your php.ini file (ex. /etc/php5/cli/php.ini for Debian-like systems):

; Use -1 for unlimited or define an explicit value like 2G
memory_limit = -1

Or, you can increase the limit with a command-line argument:

php -d memory_limit=-1 composer.phar require hwi/oauth-bundle php-http/guzzle6-adapter php-http/httplug-bundle

To get loaded php.ini files location try:

php --ini

Another quick solution:

php composer.phar COMPOSER_MEMORY_LIMIT=-1 require hwi/oauth-bundle php-http/guzzle6-adapter php-http/httplug-bundle
Tuesday, November 15, 2022
4

Have you tried setting the memory_limit to something like "1024M"?

Friday, September 9, 2022
 
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.

Tuesday, September 6, 2022
 
rotem
 
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.

Thursday, November 10, 2022
 
esabe
 
5

Your machine might have 16GB installed but PHP is not configured to use it. Locate your php.ini file (on OSX with PHP installed by Homebrew its at /usr/local/etc/php/$PHP_VERSION/php.ini. Open it with an editor and search for memory_limit. There you specify how much memory a PHP process can use. If you like to give it all change the value to -1.

$PHP_VERSION is the version of your PHP installation. To figure out which is installed use php --version.

Thursday, November 24, 2022
 
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :
 
Share