What is the best value for PHP memory_limit with 4GB of memory?

0

I have a dedicated server cloud , with 4GB of RAM and 4 Colors of 1.2GHz.

I have an extremely robust system running and would like to know how much memory to set in memory_limit in PHP 5.5?

    
asked by anonymous 08.05.2014 / 19:59

1 answer

1

In scripts that have more robust logic, where memory consumption is greater, enter the following to test and know how much memory a user has on your server, and multiplies this by the number of concurrent accesses your system usually has.

  

// We start the "counter"

     

list ($ usec, $ sec) = explode ('', microtime ())

  $ script_start = (float) $ sec + (float) $ usec;

     

/ * YOUR PHP CODE * /

     

// Finish the "counter" and display
  list ($ usec, $ sec) = explode ('', microtime ())

  $ script_end = (float) $ sec + (float) $ usec; $ elapsed_time = round ($ script_end - $ script_start, 5);

     

// We display a message

     

echo 'Elapsed time:'. $ elapsed_time. 'secs. Memory usage: '. round (((memory_get_peak_usage (true) / 1024) / 1024), 2). 'Mb';

09.05.2014 / 14:54