Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set memory_limit php 5.3 on Dreamhost

I'm currently using dreamhost to host my webiste. However an application i'm using requires a higher memory limit then the default for 90M. I'm relatively new to this and I've tried the following to try to modify the php.ini file but without any luck.

I've looked through the wiki on how to create a custom php.ini file for php 5.3, but I'm having issues setting the memory_limit.

I've followed the instructions on the following link: http://wiki.dreamhost.com/PHP.ini


Log into the panel at https://panel.dreamhost.com/index.cgi?tr...in.manage& and change your domain to use php5.3 (probably fast cgi)

Create a directory under your user called .php, with a subdirectory called 5.3. Files under this directory will be used by all domains under that user which are set to use PHP 5.3.

Example for the terminal

mkdir ~/.php
mkdir ~/.php/5.3

Once this directory exists, there are two files you can create in it:

To add custom directives to PHP, create a file under .php/5.3/ called "phprc" and add configuration directives to it. You do not need to copy the default php.ini to this file, as it is used in addition to the system php.ini; if a directive appears in both files, the one in this file will take precedence.

nano phprc

In my phprc file i've added the following lines:


zend_extension=/home/mikdur2/peachjar.com/ioncube/ioncube_loader_lin_5.3.so
ini_set('memory_limit', '128M');

The zend_extension gets picked up and verified in the phpinfo(), however, the memory_limit doesn't change to 128M. Is there another way to change the memory limit? Or is changing it in the phprc file not the correct approach. There was another post that stated that all the commands except init_set of the memory_limit worked.

Btw: here is the phpinfo() - http://peachjar.com/phpinfo.php

like image 741
darewreck Avatar asked Aug 22 '11 05:08

darewreck


People also ask

What is the memory_limit default value in PHP INI?

The default memory limit is 256M and this is usually more than sufficient for most needs. If you need to raise this limit, you must create a phprc file.

What should PHP memory limit be set to?

A typical appropriate memory limit for PHP running Drupal is 128MB per process; for sites with a lot of contributed modules or with high-memory pages, 256MB or even 512MB may be more appropriate. It's often the case that the admin section of a site, or a particular page, uses much more memory than other pages.

Where can I see PHP memory limit?

By default, a PHP script can allocate up to 128 megabytes of memory. To verify the current value of the memory_limit directive and other directives, you can use the phpinfo() function.


2 Answers

May be just write

memory_limit=128M

instead of ini_set

like image 138
YOU Avatar answered Nov 08 '22 19:11

YOU


Full code for phprc:

[PHP]
zend_extension=/home/username/ioncube/ioncube_loader_lin_5.3.so
memory_limit=1280M
like image 1
Nick Hargreaves Avatar answered Nov 08 '22 18:11

Nick Hargreaves