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:
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.
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.