Increasing the Memory Limit and Max File Size -PHP.ini

He has delusions of adequacy.

Increasing the Memory Limit and Max File Size -PHP.ini

Postby ShiftPoint » Sun Jul 05, 2009 8:50 pm

I was tasked with moving a mysql database from our production debian webserver to our internal stagging debian webserver. So I used phpmyadmin on the production server to export the database to a .sql file. Tried to import it using phpmyadmin on the stagging machine and received the following error:

Fatal error: Allowed memory size of 8388608 bytes exhausted ......


Simple fix. SSH into your debian webserver (concepts the same on most flavors of linux) and make sure your user has sudo permissions. Run:

Code: Select all
sudo vi /etc/php5/apache/php.ini


Type:

Code: Select all
/memory_limit



It will take you to the setting. By default I belive it is 8MB. You can set this to what ever you need it to be. Clearly you should not set it any higher than you need because if a rouge query is executed it could be detrimental to stability of your webserver. You will also want to take into consideration how much memory our webserver has as well. I set mine to 50MB which was enough to get my import to work.

You can google the vi commands, but for reference you can type "i" to insert then arrow over and type in the value and press "delete" to remove characters from the line. Then when your finished press "esc" to exit insert mode and type ":wq" that will write the changes to the file and exit.


Now you just need to restart apache:

Code: Select all
sudo /etc/init.d/apache restart


You may also need to check these settings as well and adjust where necessary:

Code: Select all
upload_max_filesize = 10M ;
post_max_size = 20M ;


Enjoy! :ugeek:
User avatar
ShiftPoint
 
Posts: 70
Joined: Sun Jul 05, 2009 4:52 pm
Location: Pickerington, OH

Return to Debian

Who is online

Users browsing this forum: No registered users and 0 guests

cron