Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Sorry if I didn't phrase my question correctly.

I use the php function "memory_get_usage()" to see the amount memory allocated to PHP on a script I am running.

On server A I get around 2 MB. (CentOS 6, Apache 2.2.15) The same script on server B I get around 1 MB. (Mac OSX, Apache 2.2.22)

Where should I check, or how should I fine tune my apache or php settings on server A to have similar memory footprint on server B?

For example, does the memory foot print affected by the loaded php extensions?

share|improve this question
    
You can comment on an answer if you want more information or have questions. Or edit your answer if you need to clarify some part of it. –  Drew Khoury May 5 '13 at 3:45
    
How did you go with this? –  Drew Khoury Jul 22 '13 at 12:53
add comment

1 Answer

I guess different environments will cause a script to consume different amounts of memory. I'm fairly sure that the more extensions loaded the more memory PHP will consume, so using only the ones you need is advised. You should start by comparing the versions of PHP and which modules are installed on each server.

If you're looking to increate the amount of memory a script can consume:

http://php.net/manual/en/ini.core.php

memory_limit integer This sets the maximum amount of memory in bytes that a script is allowed to allocate. This helps prevent poorly written scripts for eating up all available memory on a server. Note that to have no memory limit, set this directive to -1.

http://www.hostucan.com/webmaster-tutorials/increase-php-memory-limit

How much memory do I need?

It depends, for wordpress core, 32MB is the default memory limit. For drupal6 core, the min memory limit is 16MB, 32MB is recommended. But if you install many plugins, especially the plugins deal with image, you probably need 128MB or more memory.

There's not too much you can do config wise if you have a script that has inefficient code, if you'd like to get more bang for your buck, you should look to see if you can make the code more efficient so that it consume less memory.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.