How to edit php.ini file to increase memory limit Print

  • 4

Users can make alterations in the memory_limit using php.ini file located at /etc/php.ini. Incase you have a shared server, it is not recommended to make these changes on your own. The main reason is that, if you make changes to memory_limit on a shared server using php.ini file, every account on the server would reflect these changes. Though, this is the case with Windows servers.

Alternately, you can copy the php.ini file into the individual linux user account and search for the memory_limit in the file using a suitable editor on the server and make amendments to the values.

There is also one more method to go about doing this, ie. with the .htaccess file. Users can simply create a .htaccess file and add a code in that file.

Here is the procedure to do that :

Step 1: Build a .htaccess file using .

pico .htaccess

Step 2: If you wish to set a memory_limit of 64 MB, you must use the following code within the .htaccess file :

php_value memory_limit 64M

Step 3: Press ctrl + c for saving and exiting the file.

Step 4: You must then create a phpinfo.php file using the following :

pico phpinfo.php

Step 5: Now use the following code within the file.

<?
phpinfo();
?>

Step 6: Now look for the file in the browser and for the memory_limit and confirm if the changes have been applied.

Incase you wish to do it using FTP, then the following steps can be followed :

Step 1: Make an htaccess.txt file on your local system.

Step 2: Add the code for changing the memory_limit to the file.

php_value memory_limit 64M

Step 3: Then upload the htaccess.txt file using an FTP client software that you usually use.

Step 4: Upon uploading the onto the server using FTP account, you must rename it to .htaccess using the FTP client software.

Step 5: Create phpinfo.php file over your local machine.

Step 6: Type the following code within the phpinfo.php file.

<?
phpinfo();
?>

Step 7: Again, using an FTP client, upload it onto your server.

Step 8: Now look for the file in the browser and for the memory_limit and confirm if the changes have been applied.

NOTE: These steps can only be used by customers who have a VPS or a higher web hosting account. Customers using a shared server specifically Linux Shared Hosting must contact Linux support department for increasing the php memory_limit.


Was this answer helpful?

« Back