Do I need to restart Apache after increasing the memory_limit?
Asked Answered
C

3

7

I went into WHM and changed the settings for the php.ini

memory_limit=256M

Then clicked save. Do I need to reboot the server for a change like this? What is the best way to verify that my memory limit really is set to 256MB now?

Thanks!

Collusion answered 1/3, 2016 at 1:29 Comment(4)
What does <?php phpinfo(); say about the "Server API"? Things are a little bit different depending on whether php is integrated as an httpd-module or (f)cgi or .... You certainly don't have to reboot the whole server; at the outmost restarting the httpd service will suffice. Oh, and phpinfo() can also tell you about the value for memory_limit.Squalid
@VolkerK, the Server API said "CGI/FastCGI", which, as far as I know, would require a reboot in this case. However, when I checked memory_limit like you suggested, it shows 256MB, which is the amount that I wanted. So somehow changing it in WHM allowed the server to take higher amount of RAM without needing a reboot??Collusion
WIthout a reboot? Certainly. There's really no need to reboot the whole server, as said before at the outmost the httpd needs to be restarted. Maybe cpanel did just that. It would also be sufficient if the fcgi process manager just signaled down the php instances and then restarted them. And then there's also the option of php-FPM, running php as an external cgi server, iirc php monitors changes to the php.ini in that case - could be wrong though. Damn it, Jim, I'm a developer, not an admin ;-)Squalid
You need to restart the FastCGI process (or wait until it expires). This is not related to Apache. (Whatever, that information is vital to the question and shouldn't be scattered in comments.)Democritus
L
1

If you have cpanel installed in your sever. than location of file is

root@ping#  vim /usr/local/cpanel/3rdparty/php/54/etc/php.ini

find the keyword memory_limit

; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit
memory_limit = 128M

Increase this limit to 256M and save the file. This will fix it for you.

just saving the file will restore the settigs.

Lura answered 9/3, 2016 at 18:10 Comment(1)
Keep in mind you need root access to edit this file.Lura
L
0

No need to restart server as when you made changes from WHM it automatically restart the required services which needs to be restart.

I would be able to help you specificly if you can tell me exactly why you want to increase your memory_limit?

Lura answered 3/3, 2016 at 22:8 Comment(1)
I am trying to implement a javascript / PHP spell checker. I was getting strange results and the developer said I should set the memory size to 256MB for PHP.Collusion
J
0

Restart apache after the change >> sudo apachectl restart

Johnnie answered 25/4, 2023 at 12:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.