How to change the memory_limit in .htaccess file
Users will build alterations within the memory_limit using php.ini file located at /etc/php.ini. Incase you’ve got a shared server, it’s not suggested to make these changes on your own. the most reason is that, if you make changes to memory_limit on a shared server using php.ini file, each account on the server would replicate these changes. Though, this is often the case with Windows servers.
Alternately, you’ll copy the php.ini file into the individual linux user account and search for the memory_limit within the file using a appropriate editor on the server and make amendments to the values.
There is also one additional method to go about doing this, ie. with the .htaccess file. Users can easily create a .htaccess file and add a code therein file.
Here are the steps 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.