phpsymfonycomposer-phpknppaginatorsymfony-3.3

symfony 3 knp paginator composer file not found


I'm building a blog in symfony 3 and Sonata. I'd like to use knp paginator so I put that command :

require knplabs/knp-paginator-bundle

It gives me that error :

PHP Fatal error:  Allowed memory size of 1073741824 bytes exhausted (tried to allocate 4096 bytes) in

phar:///usr/local/bin/composer.phar/src/Composer/DependencyResolver/Solver.php on line 220

So I did that :

php -d memory_limit=-1 composer require knplabs/knp-paginator-bundle

This gives me that :

Could not open input file: composer

If I just add the line in my composer.json and run composer update, it gives me the same error of size, if I add "php -d memory_limit = -1" it tells me "could not open input file : composer" I did not have this error before, I've already use that "php -d memory limit" and it worked fine, I don't know what to do anymore I need that paginator bundle for my project Does anybody have any ideas ?


Solution

  • This usually happen when you use a globally installed composer.phar files. So You should (1) locate the absolute path of the installed composer file then (2) use the absolute path in the php usage, as example:

    ~ ᐅ php -d memory_limit=-1 composer
    Could not open input file: composer
    ~ ᐅ which composer
    /usr/local/bin/composer
    ~ ᐅ php -d memory_limit=-1 /usr/local/bin/composer
       ______
      / ____/___  ____ ___  ____  ____  ________  _____
     / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
    / /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
    \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                        /_/
    Composer version 1.4.1 2017-03-10 09:29:45
    

    Hope this help