Speed Prestashop up with php.ini

I kind of lied in the title, doing this will actually speed all php programs up. This is a dead simple trick and if you host lets you take advantage of using a php.ini you can greatly increase the performance of your shop on the server side. Most web hosts allocate a certain amount of memory per account, but using a php.ini file you can increase the amount of memory that your site has. The bare minimum you need to run prestashop 1.4 is 32 mb of memory. Prestashop 1.5 however needs at least 64mb memory. As a reference though, I usually deploy shops at either 256mb or 512mb, just depending on how resource intensive I think the shop will be. I do, however, have a couple with 2gb and 4gb memory. Also, if you are getting errors from not being able to load the translations file, this will solve them too.

We now offer PrestaShop speed optimization as one of our services. The button below will take you to all of our different speed optimization packages.</p>

First things first

First thing you will want to do is make an php info file to see how much memory your site has. Create a new file in a text editor and paste this in the file.

<?php

// Show all php information
phpinfo();

?>

Now save this file as info.php and upload it to your root directory. Now point your web browser to the file and it will let you know just about everything having to do with your php installation. It should look like this below.

php.info file

 

Now in the file navigate down to where it has you memory limit. You can see in the image below I have 3 lines highlighted. The memory limit is how much memory your hosting account can use. The max input vars is how many text fields that your Prestashop installation can use on one page. The translations page loads about 1500 I think, so that will need to be increase. Also I have highlighted the max execution time. This can be real handy during csv imports. If you csv imports are timing out and failing, you can adjust this also and it will solve that problem.

phpmemorylimit

 

 

Php.ini file

Now lets create another blank file and paste this code below in the file.

<?php
memory_limit = 2048M
max_execution_time = 1000;
max_input_time = -1;
post_max_size = 15M;
upload_max_filesize = 15M;
max_input_vars = 10000;
suhosin.get.max_vars = 10000;
suhosin.post.max_vars = 10000;

?>

If you look at the code, I have also added a few other things. I increased the post file size to 15mb and turned off the max input time. Now save this file and upload it to your root folder on your server. Now navigate to your info.php file and see if the values are updated in the file. Look at mine below.

php memory increase

 

If it does not work, you can contact your host and ask them if they allow php.ini files. Some hosts, such as Hostway, make you put the file in your cgi-bin folder. So if it doesn’t work right off the bat you might want to talk to your web host. I can tell you it works with most hosts. Have fun with your faster shop and happy selling.

 

About the Author: Lesley Paone

Lesley has worked in e-commerce for over a decade, and is the founder of dh42. Starting out with PrestaShop and brancing out into other platforms like Shopify. He loves all things e-commerce and loves a challenge, in his spare time he helps moderate several forums on SEO, e-commerce, as well as the PrestaShop forum. If you have any questions for him about any of his articles just use our contact form to contact him.

Share: