PHP Memory Limit

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • code green
    Recognized Expert Top Contributor
    • Mar 2007
    • 1726

    PHP Memory Limit

    Is there a maximum or recommended limit to the amount of memory allocated to a PHP script.
    Some queries on a MsSql database are breaking a temporary 72mb limit.

    I feel comfortable increasing this to 128mb but how far can the limit be set?
    And should the limit be multiples of 8mb or can say 100mb be allocated?
  • dlite922
    Recognized Expert Top Contributor
    • Dec 2007
    • 1586

    #2
    I've worked on pretty big applications. PHP has been able to handle pretty well.

    You asked about memory limit of PHP, then stated a MsSQL query taking up memory which confused me.

    MsSQL is a different process than PHP. It should have it's own settings of what is the max amount of memory it should use and setting it will be totally dependent on your system.

    A system dedicated only to DB transaction should be allowed to grab the entire memory (and cpu) of that system or at least the majority of it.

    In a multi-gig system dedicated to php/web server, I feel comfortable setting php to 500MB.

    To answer your last question, you can use any number not just multiples of 8.


    Dan

    Comment

    • code green
      Recognized Expert Top Contributor
      • Mar 2007
      • 1726

      #3
      Sorry for confusing you.
      I was referring to the php function call mssql_query().
      Must admit I'm not sure of the workings behind this, but the function call causes the php memory to overflow.
      Fatal error: Allowed memory size of [###] bytes exhausted (tried to allocate ....
      I have to assume the result set is transferred from SQL Server to PHP.
      So a query returning a huge amount of data exceeds the limit set in php.ini or set by
      Code:
      ini_set('memory_limit','72M');
      In a multi-gig system dedicated to php/web server, I feel comfortable setting php to 500MB
      I have a server dedicated to Apache, MySql and PHP, but it is not a web server.
      SQL Server is on a different server along with our sales/stock/distribution software.
      They used to be on the same server so I was careful of memory allocation.
      500mb ought to be plenty.
      Thanks for the advice

      Comment

      Working...