PHP is an excellent choice for programming and code applications as like WordPress and Joomla. (By focusing on the most used CMS) have made it even more popularized, as their databases are running on this language. But everything they offer us, good CMS based sites or applications such as forums or electronic stores can have it sometimes conflicting.
In this article, we delve into how to solve performance problems of PHP, paying particular attention to aspects related to WordPress and Joomla.
Correctly configure the cache
The biggest problem with the web pages based on CMS is solved by what is known as “cache”. It turns out that, all pages based on WordPress or Joomla, they include processing code on the server side (written in PHP language) and access to the database (usually with the MySQL management system). This means that, for a visitor that accesses our website, you have to launch a series of processes to compose the response to be sent to the client. Run PHP and MySQL do not have a cost that can be considered negligible. On the contrary, it means an intense work for the server, especially when it has to address many concurrent visits to the website.
If the web hosting server serves static pages (HTML code does not need processing by PHP to be generated) it would be much faster to generate pages from PHP and MySQL. The solution is to use the cache system. The cache enables each time a page is built using PHP and MySQL, CMS is stored in the system and produces static HTML version of that page. The following accesses the same content will be sent to the cached version of that page and therefore does not require reproducing of the page on the server, saving processing time accordingly.
However, in many cases, the cache is not the solution to all problems, since a lot of traffic that the URL is going to get includes parameters that tease and disable the cache system. For example, if a visitor comes to us through a social network, an RSS news aggregator or similar systems, often the URL will be like this:
http://www.example.com/article/article-cache.html? utm_content = buffer4599328 & utm_medium = social & utm_source = twitter.com & utm_campaign = buffer
All these data URLs coming with “?” symbol at the end make WordPress understand that new content is not cached. However, despite this problem, the use of the cache will always bring a significant performance that no developer should miss.
Delete requests to the server
Another factor adding to the site is a very fast deletion of requests on the server. When a page is not only a query, the server sends the HTML, as well as CSS, Javascript files, images, etc. Each of these files is a request to the server and page speed drops sharply when many files are requested separately.
The use of purchased or free templates for WordPress, as well as, many plugins suffer from this serious problem and makes many unnecessary requests to the server, or at least many that could be avoided with a little optimization and doing things for ourselves.
Lowering requests to the server is a task that involves “fine-spun” and needs to have important knowledge, not only of WordPress or Joomla but development in general. Some of them were already covered in our blog earlier.
Related- Most Common Mistakes Web Developers Make
Watch out Bots!
Finally, we note that not always our PHP pages are visited by real people. Often they are “bots” or “robots” who are touring the site very intensively and make the accommodation promptly suffer and at certain times, some bots are desirable, such as Google, which runs the pages to index your content. Others may be less desirable and even harmful and for those who are advised to have installed one of the most popular security systems plugins, captcha plugin on WordPress for blog posts, forms, etc.