3

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 have this error : enter image description here

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.

4
  • 1
    Did you edit the correct php.ini file? You can check which .ini files are used by running php --ini make sure that none of the additional .ini files is overwriting your memory_limit. You can check it with php -i (and search for memory_limit) or if bash and grep is available (eg. git bash) try php -i | grep memory_limit to see if your memory_limit is set correctly. Commented Feb 8, 2017 at 9:55
  • 1
    You say you have set your memory limit to 1G, but your error says the allowed size is about 134MB. @Peh is probably right: you did not, in fact, change the right memory limit. Commented Feb 8, 2017 at 10:01
  • @Peh I did php --ini and here is the result : Loaded Configuration File : C:\wamp64\bin\php\php5.6.16\php.ini. So the good file is obviously used. Going to check if this file has my 1G limit or not and ... it has a 128M limit !! Actually, using Wamp context menu, I modified C:\wamp64\bin\apache\apache2.4.17\bin\php.ini even if I clicked on PHP folder > php.ini (in the menu). Commented Feb 8, 2017 at 10:47
  • 1
    @Peh : So, in the php.ini of PHP, I replace 128M by 500M, I think it's enough... Thank you !! The Wamp menu is very done poorly... Commented Feb 8, 2017 at 10:50

2 Answers 2

0

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.