Results 1 to 4 of 4

Thread: How to increase memory limit in php

  1. #1
    Join Date
    Feb 2009
    Posts
    32

    How to increase memory limit in php

    hello friends,

    I want to increase my memory limit in order to make my website run faster. I know it's possible with the php code, many webmaster do it . But I am completely unaware of this ? can anybody help me with how can I increase the memory limit using php ?

    plz help....

  2. #2
    Join Date
    May 2008
    Posts
    2,012

    Re: How to increase memory limit in php

    The default memory is set for 8M

    Warning- Before doing anything, always make a backup file of php.ini .
    Note - If you don't know where your php.ini file is located, the phpinfo.php file will show you where the pnp.ini file is at.

    Open your php.ini file. If your server is a Webune Dedicated Server with Redhat, Centos or Fedora, you can run the following command to edit the php.ini file:
    Code:
    nano /etc/php.ini
    Find
    Code:
    memory_limit = 8M ; Maximum amount of memory a script may consume (8MB)
    and replace with
    Code:
    memory_limit = 16M ; Maximum amount of memory a script may consume (8MB)
    Save the file - press Ctrl+x. You will be asked to save changes, type the letter "y" for yes

    Hit Return at the next prompt.

    Restart Apache Server with the following command
    Code:
    /etc/init.d/httpd restart
    Here, your phpinfo.php file should show 16M instead of 8M

  3. #3
    Join Date
    May 2008
    Posts
    2,297

    Re: How to increase memory limit in php

    If you are using drupal and wish to increase php memory limit -

    1. Locate the php.ini file used by your web server. (Tip - use the phpinfo() PHP function to find it). During installation Drupal checks the PHP Memory Limit and if it's less than 16M an error message also provides the path to the php.ini file.

    2. Edit the memory_limit parameter in the php.ini file (usually in a section called Resource Limits)
      memory_limit = 16M ; Maximum amount of memory a script may consume (16MB)
      If there is no section already for this, place the above line at the end of the file.

    3. Restart Apache.

  4. #4
    Join Date
    Feb 2008
    Posts
    1,852

    Re: How to increase memory limit in php

    Changing Memory Limit

    There are 3 ways -

    1. Changing memory_limit globally from php.ini

    This is the simplest method. In this, you just need to edit your php.ini and change the memory_limit to whatever you need. For eg:
    memory_limit = 32M

    To do this, you will need access to make changes to php.ini on the system. Since this change is global, it will be used by all php scripts running on the system. Once you change this value, you will need to restart the web server in order for it to become active.

    2. Changing memory_limit using .htaccess for a single folder/vhost

    If you want to change the memory limit only inside one folder (normally one application or virtual host) that needs this value changed for its functionality, you have to add to the respective location .htaccess something like:
    php_value memory_limit 64M

    This change will be local only, and can be useful for webmasters that don’t have control on the system php.ini. This change would not require a reload and will become active immediately.

    3. Changing memory_limit inside a single php script.

    You can even set the memory limit to the directive inside a single php script. To do so,
    ini_set('memory_limit', '64M');

    The advantage of this method is that you have more control and set this value just where you know it is really needed. Also it can be done without having access to the system php.ini, and will become active immediately.

Similar Threads

  1. How to increase Creative X-Fi 8000 song limit
    By Visitator in forum Hardware Peripherals
    Replies: 5
    Last Post: 24-04-2011, 10:18 AM
  2. Increase RAR attachment Limit
    By avvia in forum Windows Software
    Replies: 3
    Last Post: 06-07-2009, 11:53 AM
  3. Replies: 3
    Last Post: 22-02-2009, 09:38 PM
  4. Increase the PATH environment variable limit to 2048 char on 2003
    By Morten Ross in forum Windows Server Help
    Replies: 5
    Last Post: 21-05-2008, 01:01 AM
  5. Increase database size limit to 75GB in Exchange
    By Landon in forum Small Business Server
    Replies: 1
    Last Post: 30-03-2007, 09:40 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,864,243.97417 seconds with 17 queries