Reputation: 806
I have a Symfony3 project on my localhost (Windows 7 Entreprise) and I use Wamp Server 3.0.0 with PHP 5.6.16 and Apache 2.4.17.
When I do : php bin/console cache:clear
I also have a memory limit error every time I use Composer (for installing bundles for example).
I modified my php.ini : memory_limit = 1G
and restarted all services of Wamp.
I still have this problem. My project is a big one so maybe it comes from it.
The only solution that I found is to increase memory limit in every command line (-1 = unlimited) :/
php -d memory_limit=-1 C:\Path\of\composer.phar require ...
In production, my project is on a Windows Server 2008 R2.
Have you a better way to increase memory limit for my entire project ? Thanks for your help.
Upvotes: 3
Views: 10771
Reputation: 317
I had this issue, maybe my case will be helpful for someone.
Check php version you are using as php cli by typing php -v in command prompt. Then check php version your web-server is using - create php file
<?php
phpinfo();
and run it on your server. In case the versions are different, you have to follow such route on windows:
Control Panel->System and Security->System->Advanced system settings->Environment Variables
Below System Variables table you should see Path variable. The php version mentioned in the path is used as php cli. Change the route to the php version your server is using (where you modified memory_limit). Then you have to close all your active command prompt windows for changes to be made.
Upvotes: 0
Reputation: 10
Try set
@ini_set("memory_limit",-1);
Run
php -i|grep php.ini
To find where php.ini and echo phpinfo() after setting .
Unset the variables after using and optimize your code.
Upvotes: 0