Home > Software engineering >  Increase in Memory Limit on PHP WampServer not working - keeps reverting to original value
Increase in Memory Limit on PHP WampServer not working - keeps reverting to original value

Time:01-19

I have PHP running on an installation of Wamp. I am trying to upgrade the version to PHP 8.2.1, from 7.4.0. This is because of a separate error I have encountered when trying to install the symfony framework:

api-platform/core[v3.0.0, ..., v3.0.10] require php >=8.1 -> your php version (7.4.0) does not satisfy that requirement.

The memory size is currently set to 128MB. When I change the 'memory_limit' variable inside my php.ini to 256MB and then restart wamp, and then click on the wamp icon and go to 'PHP', 'PHP settings' and then 'Memory Limit', its still showing the memory limit to be 128M.

In my error log, I have the following error:

PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 158 bytes) in C:\wamp64\scripts\refresh.php on line 2263

I wondered if anyone had any suggestions?

Thanks,

Robert

CodePudding user response:

First there are 2 php.ini files in WAMPServer, one for the Apache webserver environment and one for the CLI (Command Line Interface) environment.

So if you want to alter anything in WAMPSevrer use the menu's provided on the Wampmanager.exe (the W icon in your system tray or maybe its still in the overflow area)

First, once you have installed the PHP8.2.1 ADDON, you have to select the version of PHP to be what is used by Apache, it wont get changed by the install of the ADDON.

left click wampmanager-> PHP -> Version -> Click the version of PHP you want

This will automatically restart Apache. So Apache will now be using the newly selected version of PHP

So if you want to alter the memory limit for the Apache web server environment, use the menu's provided on the Wampmanager.exe (the W icon in your system tray or maybe its still in the overflow area)

left click wampmanager -> PHP-> php.ini [Apache module] 

and it will load the CORRECT php.ini into your default text editor. Make the changes to memory limit, save and close, then restart Apache again using the wampmanager menu's

left click wampmanager-> Apache -> Service Administration -> Restart Service
  • Related