2. What are the main elements to take into account to perform the optimization in Prestashop stores?
In this tutorial we are going to focus on the explanation of the following web parts that directly intervene in the optimization process:
Server (Web Hosting)
2.1 Server (Web Hosting)
The server is one of the most important and crucial elements to ensure the proper functioning and optimization of a Prestashop online store.
As you know, A server is basically a computer (there are from small towers whose use is domestic to large consoles with dozens of racks within complex infrastructures and under strict management and security protocols) Where all the files that make up the online store are stored, its database and all the elements necessary for the interpretation of the server-side language used by the web platform (PHP and MySQL). It is in charge of processing browser requests, making inquiries to the database, interpreting the source code of the platform to return all that information requested to the web browser.
The browser will be in charge of showing the user all that information received by the server in a graphic and visual way so that he can interact on the website.
Having said all the above, we can deduce that the better the quality of the server and the availability of its resources, the higher its speed in processing data and requests, and therefore, the higher its performance. This translates into high web loading speeds, speed in displaying information on the client side, and agility in processing queries to the database. In short, higher server performance generates better SEO results, minimizes the occurrence of errors, improves the user experience and increases customer confidence and online sales.
2.1.1 Choosing the best and most suitable web server for use with Prestashop platforms
We have seen that on numerous occasions, Prestashop online store owners, due to ignorance, tend to hire web servers that are not suitable for use with Prestashop online stores. They tend to fall into the error of hiring web hosting plans from providers that are well known because they invest a lot of capital in marketing and offer hosting services at very low prices. However, these hosting providers do not offer quality servers or optimized for use with online stores that require high resources.
Many of these servers coming from these providers, have few resources, are very limited and for reasons of internal guidelines, they cannot adapt the limits of these resources to each client.
If you are starting in the world of e-commerce, it is possible that at the moment you will not find problems hiring this type of servers. However, as your online store grows, increases its daily visits or you need the installation of a powerful addon (module) that requires server resources, you will start to have serious problems. Even your online store could be inoperative on many occasions due to exceeding limits on the use of server resources.
Next we are going to give you the guidelines and the necessary knowledge so that you can choose the best web server for your Prestashop online store.
Web server type
There are several types of web servers that are served as web hosting plans. The most used are the following:
These servers are called LAMP Servers (Linux – Apache – MySQL / MariaDB – PHP) because they are based on the use of the most widely used software and languages that are specific for managing websites.
- Linux operating system
- Apache server
- MySQL / MariaDB database server
- PHP language interpreter
Regarding this topic, we have an article that we published previously, and that explains in much more detail each of these types of web servers. You can visit this article at the following link:
As we explained in the article, if we want our Prestashop online store to work correctly and have a high increase in performance, we will have to hire a VPS or Dedicated web hosting plan , and that this hosting plan allows us to configure the server parameters without restrictions . So we should ask our hosting provider for any restrictions or limitations they may have.
We do not recommend at all the use of shared servers for Prestashop online stores
2.1.2 The most important server parameters and resources
When choosing a web server and configuring its parameters to optimize it for Prestashop stores, we must pay close attention to the following elements:
Disc type and capacity
The processor is the brain of the server. He is in charge of carrying out all the processes. Its saturation is the first indication that it has reached its limit and cannot continue processing until it is relieved of its workload. For that reason, the better and more powerful the processor, the faster it will process and will not crash easily.
When a CPU reaches more than 90% usage, the server becomes overloaded, slows down, and the loading speed of the online store is greatly reduced. This situation causes the website to load endlessly without showing its elements to the user.
In this sense , we recommend hiring servers with CPUs from 4 cores (4 Core) and with clock speeds of more than 2.0 GHz.
Disk type and capacity
Currently there are two types of disks for data storage: HDD and SSD .
The HDD disk is a series of disks that rotate and their data is read and extracted by your reader device. Therefore, the read and write speed is slower than SSD drives.
SSD storage disk
SSD (Solid State Disk), compared to HDD (Hard Disk Drive), is much faster. This is because the SSD is a solid disk based on a chip where the data is stored. It is similar to memory sticks.
The use of servers with SSD disks is recommended to increase the speed of reading and writing data. This translates into higher performance and loading speed of the online store.
RAM (Random Access Memory) is responsible for storing the data of the processes that are running on the server in real time. So to speak, it is the right hand of the CPU and is in charge of storing the necessary data that the CPU needs during the calculation of the processes. Translated to the server, it is in charge of storing the data of the processes that are executed when the web browser requests the information from the server. When the size of the processes exceeds the value of RAM, it crashes and has the same effect as when a CPU crashes. The user could experience a considerable increase in the loading time of the web page, even to the point that the web browser is blocked trying to load the elements of the site.
In web servers, there is an element called SWAP Memory , and whose objective is to use the server’s hard disk to store these processes and thus not collapse the RAM memory. However, the bypass and swap process is slower than if RAM were physically used to store the processes. If you have contracted a VPS or dedicated web server with a high RAM memory value, we recommend disabling the use of SWAP memory.
When a user visits a website, as we have explained above, there is a request to the server and a response from it. During this process data is exchanged, and this data has a size.
Web hosting providers usually put monthly traffic limits on their hosting plans. This happens especially when the hosting plan is shared or they are very cheap plans. The monthly traffic limit is the limit of the total value of the sum of all the data transferred between the server and the web browser during a month.
In the event that there is a monthly traffic limit, when the maximum limit is reached, the server will stop processing requests and from that moment the online store is completely inoperative.
It is very important NOT to hire web hosting plans that have a monthly traffic limit.
Apache is software for web servers (based on the Linux Operating System) that controls the HTTP (Hypertext Transfer Protocol) in requests from the web browser to the server. It is responsible for returning the requested information through this HTTP protocol.
It is very important to pay attention to the optimization of your configuration to be able to take advantage of all the server resources and thus increase the performance of the online store.
The servers that use Apache have a very important file called .htaccess which is the file in charge of storing the Apache configuration. This file is located in the root directory of the Prestashop store . By inserting code inside it, we can do important things such as the use of the server and browser cache, increase web security, deny access to certain IPs, protect directories, use redirects, etc …
To be able to edit this file, advanced knowledge is required, otherwise, an error in the code could cause a 500 server error that would render the online store completely inoperative.
We have put together a specific article that explains in detail how to edit and optimize the .htaccess file with advanced parameters.
In addition, we have developed the Advanced Editor Htaccess module, which is specific to edit the .htaccess file of Prestashop online stores easily and quickly with a syntax editor. It also includes an option to increase the performance of the store and the use of the site cache.
You can buy it right now from the official Prestashop Addons page, at the following link:
The web servers have PHP language interpreter software installed , since this is the language used by the vast majority of websites. As with the rest of the components mentioned above, this one can also configure its parameters in order to optimize and increase the performance of the website.
The configuration of the PHP parameters is really one of the most important and decisive parts when it comes to ensuring a good functioning of the web server and avoiding errors or server crashes.
When we hire a shared web hosting, it usually has many limitations when configuring the PHP parameters. In addition, the values of its parameters are usually very low, so they usually cause problems if it is intended to be used with Prestashop online stores. For that reason, we have mentioned that we do not recommend the use of shared web hosting for online stores .
There are many PHP parameters that can be configured. However, we are going to mention the most important ones to take into account:
- max_execution_time: Sets the maximum time in seconds that a script can run before it ends. The default is usually 30 seconds.
- max_input_time: Sets the maximum time in seconds that a script can parse input data, such as POST and GET. This is generally increased to allow for large file uploads.
- memory_limit: It establishes the maximum memory limit that must be used for the processes. Websites that perform long or heavy processes will need a high memory limit value. Depending on the amount of RAM memory available on the server, the value can be increased in proportion.
- max_post_size: Sets the maximum size allowed for POST requests.
- max_upload_size: Sets the maximum size allowed for uploading files to the server. For example, from the contact form on the website.
- max_input_vars: Sets the maximum limit of variables that can be accepted during requests to the server. In the case of online stores, a low value of this parameter can cause problems when displaying translations.
- allow_url_fopen: This option enables URL type fopen wrappers that allow access to URL objects such as files. The default wrappers are provided for remote file access using the ftp or http protocols. We recommend having this option activated, since there are modules and addons that need to connect with external URLs to carry out their processes.
You can get more information about these parameters in the PHP manual .
We can configure these parameters in several ways:
- .Htaccess file
- Php.ini file
- .User.ini file
- Through the hosting control panel
For the proper functioning of a Prestashop online store, these parameters should have the following values:
These values are valid for a Prestashop online store hosted on a server with a normal level of resources and with a RAM memory value from 2GB