Increasing the Default PHP Memory Limit on your Apache Server

Many Apache servers have default PHP memory limits of 8MB, which is insufficient to run many modern software programs and CMS platforms based upon memory needs. Therefore, webmasters may need to increase the PHP memory limit in order to properly run core software as well as add-on modules.

Modern web applications often require variable memory usage depending on their specific implementations, with error messages halting operations where memory is not sufficiently allocated.  Some application require up to 64MB of PHP memory to operate properly, requiring an update to your PHP settings.

In order to ensure smooth operations of your web application where you have user contributions, dynamically pulled media content and add-on modules, it’s important to follow these two steps in order to increase the default PHP memory limit on your Apache Server:

Update the Settings on your PHP.ini configuration file

    For webmasters who have access to their PHP.ini file, this is the recommended route for updating PHP memory settings. Severs in shared hosting environments may require alternative update methods, which are detailed below.

    To start, find the .ini file within your web server – you can identify this with the phpinfo() command on your shell prompt. This information from phpinfo will provide a broad set of data including the complete location of your file. Certain LAMP servers may have a php.ini file in both the PHP and Apache/Bin folders.

    In order to implement the new settings you should update the Resource Limits memory_limit parameters to increase the maximum script memory allowed. The setting will be written as:

    memory_limit = nnM (where nn is the current memory limit)

    Once you have updated the file according to your needs, restart your Apache server.

    Update the settings on your .htaccess file

      For those in a shared hosting environment, you may have to add the following line to your .htaccess file in order to trigger updated PHP memory settings:

      php_value memory_limit nnM

      0 responses so far ↓

      There are no comments yet...Kick things off by filling out the form below.

      Leave a Comment




       

      Search Website

       
       
       

      Top 10 PHP Hosting Providers

      MyHosting - $4.00 USD
      InMotion Hosting - $5.95 USD
      WebHostingHub - $4.95 USD
      JustHost - $3.95 CDN
      iPage - $3.50 CDN
      HostGator - $4.95 USD
      FatCow - $3.67 USD
      GreenGeeks - $4.95 USD
      BlueHost - $6.95 USD
      10 GoDaddy - $4.11 CDN