Email
Share

We Rock Your Web Forum » Service Providers » Hosting

Where to find, how to edit php.ini?

(4 posts)
  1. obelix

    member
    Joined: Jul '09
    Posts: 15

    My website (bbPress) keeps giving me an error when I try and post a reply: bbpress Fatal error: out of dynamic memory

    I've read that I need to increase memory limits in my server's php.ini file. I run a VPS, so I should have the permissions to do this.

    My question is - where is my php.ini file and how do I go about making changes in it?

    Posted 2 years ago #

  2. Posted 2 years ago
  3. GrafixFilter

    member
    Joined: Nov '09
    Posts: 13

    You can upload a phpinfo.php file to your root directory, that simply contains:

    <?php phpinfo(); ?>

    When you access the file at example.com/phpinfo.php, you'll see information regarding your PHP installation. In the first table, you should see a row labeled Configuration File (php.ini) Path, followed by the directory that contains your php.ini file. You may also see a Loaded Configuration File entry right below that that will contain the exact path to php.ini.

    For security reasons, it's probably best to delete the file when you're done viewing the information.

    Posted 2 years ago #
  4. cwd

    senior admin
    Joined: Jul '09
    Posts: 225

    Thanks Grafix. Obelix - you can increase your PHP memory limit by editing the following line in your php.ini file:

    memory_limit = 8M

    Increase the 8M to 16M or whatever value you desire to give yourself more memory. That should help prevent the Fatal error: out of dynamic memory errors from recurring.

    You can also increase the default upload limit on files from 2MB by editing the following line:

    upload_max_filesize = 2M

    You'll need to restart Apache to have changes to php.ini take effect. Note that Apache is restarted by default during several server actions, including the creation of a new account.

    If you don't know how to access your php.ini file, you can try using SSH, and loging in via Putty. Log in as user root. Once logged in, type the following at the command prompt:

    vi /usr/local/lib/php.ini

    Type the following to find the php.ini line addressing your memory limit:

    /memory_limit

    Once you find the line, press the i key on your keyboard to switch to insert mode. This will let you modify the memory value.

    Once you're done, type :wq to save your changes and exit.

    If you don't have access to php.ini (ie. are on a shared server), you can try modifying the memory value via your .htaccess file. Add the following line:

    php_value memory_limit 48M

    In this case we've allocated 48MB of memory. Increase/ decrease this value as necessary.

    Posted 2 years ago #
  5. cwd

    senior admin
    Joined: Jul '09
    Posts: 225

    Btw, for Drupal CMS websites it's also a good idea to set the
    mysql query caching = 16M
    or higher. This way there will be room for your queries to be cached. You should have caching up and running to minimize the mySQL calls to your database, and it's not a bad idea to disable watchdog as well, to conserve resources, if you're not making use of it.

    Posted 2 years ago #

RSS feed for this topic

Reply

(required)

Allowed markup: BBcode blockquote code em strong ul ol li font strike center u hr.
You can also put code in between backtick ( ` ) characters.