answersLogoWhite

0

If you are running into PHP memory leaks and frequent our of memory errors you can try moving your code into functions. PHP automatically does garbage collection after each function call. Another thing i tend to see a lot is that connection strings are not closed after using them as this cause build up and cause memory issues as well.

User Avatar

Wiki User

16y ago

What else can I help you with?

Related Questions

How to reduce the memory leak in php?

If you are running into PHP memory leaks and frequent our of memory errors you can try moving your code into functions. PHP automatically does garbage collection after each function call. Another thing I see a lot of is not closing your database connection strings after using them as this cause build up and cause memory issues as well.


Where can one find information bout PHP INI online?

One can find information about PHP INI online when one goes to the website of silverstrip dot org. This site gives information as to how one can solve the problem one encounters at online hosting,


How do you solve PHP fatal error?

Your first course of action is to increase your memory limit. Note, this is a temporary debugging procedure. The goal is to increase the memory to a point where we have the application working again for the purpose of then reducing the memory usage. Once you decrease the memory usage you can lower the memory limit it to a value that's more suitable. Your plan should be to use as little memory as you could practically use where the application works and functions correctly in a production server based on the workload by your users (humans or programmatic). I usually recommend setting the memory limit to something high, like 1GB, assuming you have at least 150% of that free in RAM.Also, never do these tests on a production server unless you're sure you have plenty of RAM and you fully understand how web server processes consume memory. You could easily bring a server to its knees if there are many concurrent processes running, each using a high amount of memory. I would never, ever recommend setting the memory limit to -1 (unlimited) in a production environment. That's a recipe for disaster. Don't make that newbie mistake.So how do you do this? Simple - increase the memory limit programmatically early on in your code, before your process runs out of memory. If you do it this way, you can give PHP extra memory only when that piece of code gets called rather than increasing the memory limit for all PHP processes.1 .


How do you install PHP on a memory stick?

You can install an entire web server on your flash drive with XAMPP Portable. http://portableapps.com/apps/development/xampp You will need an entire server (at least Apache and PHP) if you want to execute PHP scripts.


Are there any performance benefits over using PHP as opposed to ASP?

PHP code runs faster than ASP. ASP is built on COM based architecture, which is an overhead for the server whereas PHP code runs in its own memory space.


When should globals be used in PHP?

Problem with using global variables in php is that they lose the the assigned value in a different php file. They only keep the global variable value in the php file in which they are declared. Instead of globals try and use $_SESSION or $_COOKIE to keep value intact across different php files in a project


How to solve what if your php installation appears to be missing the mysql extension which is required by wordpress?

Ideal thing to do would be to delete all your installation & install a single WAMP/LAMP server. It combines all the features necessary to run php including windows/linux, apache, mysql & php


How can I find the biggest integer my computer can handle using PHP?

You may use the following code to see how far you can push your computer via storing integers; the biggest integer allowed in PHP actually depends on the system PHP is running on, and how big of an integer it allows in its memory. It's advised that, if you really want to do this, that you turn off PHP output limiting, so then you don't get an exhaustion error. <?php for ($i = 0; TRUE; $i++) { echo $i; } ?>


How do you solve error. code 170004 in php?

Do you have an index.php file in the root folder ? This is a common cause of failure. In some case, copy index.html to index.php resolve the problem. If you have index.php, you may need to supply debugging during staging (e.g. set BP_DEBUG option).


What is 10 percent in Php 250?

Answer: Php 2510% of Php 250= 10% * Php 250= 0.10 * Php 250= Php 25


Day-to-day quadratic equation I need a word problem that is a quadratic equation.?

a really developer sells resedential lots for Php 4,000 per square meter plus a processing fee of Php 25,000 one of the lots the really developer is selling cost Php 625,000


What is a php consultant?

PHP Consultant is a Expert PHP Developer who Guide PHP Development Process