Search code examples
laravel-5composer-phpintervention

Memory exhausted and PHP Version mismatch errors. Not able to install image intervention laravel 5.5 package


I want to change color of my image. So I'm trying to use image/intervention of laravel. Followed their documentation: http://image.intervention.io/getting_started/installation https://packagist.org/packages/intervention/image

When i tried the following, i got an memory exhausted error:

1. composer require intervention/image

Error: PHP Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/DependencyResolver/Solver.php on line 223

Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/DependencyResolver/Solver.php on line 223

Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors. E:\xampp\htdocs\Myproject>php -r "echo ini_get('memory_limit').PHP_EOL;" 512M

So, i followed the below link and increased to memory_limit=-1 from memory_limit=512M https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors

Now, again tried this command composer require intervention/image. Now i got a different error:

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

Problem 1 - This package requires php ~7.2.0 but your PHP version (7.3.11) does not satisfy that requirement. Problem 2 - mpociot/vat-calculator dev-master requires ext-soap * -> the requested PHP extension soap is missing from your system. - mpociot/vat-calculator dev-master requires ext-soap * -> the requested PHP extension soap is missing from your system. - mpociot/vat-calculator dev-master requires ext-soap * -> the requested PHP extension soap is missing from your system. - Installation request for mpociot/vat-calculator dev-master -> satisfiable by mpociot/vat-calculator[dev-master].

To enable extensions, verify that they are enabled in your .ini files: - E:\xampp\php\php.ini You can also run php --ini inside terminal to see which files are used by PHP in CLI mode.

Installation failed, reverting ./composer.json to its original content.

Why am i getting these errors? How can i install image/intervention package in my application? I'm using laravel 5.5 , PHP 7.3.11

As the error says, do i have to install 7.2.0 php version? Or is there any other solutions?


Solution

  • The first problem come because there is something like "php": "~7.2", in your composer.json. Change to "php": ^7.2" to allow all PHP minor version upper 7.2. Run composer update php to fix composer.lock

    The second problem is because you are missing soap extension in PHP. Try to install it. This question/anwser could help you.