Best php configuration for wordpress

I have a big site with several plugins that take up memory, a lot of requests to the server, etc. I've maxxed out my hosting to help account for this, but are there optimum PHP and Wordpress settings for big heavy site, or just optimum PHP base settings for Wordpress period.

Here are my current settings:

allow_url_fopen =   Disabled
allow_url_include   =  Disabled
display_errors      = Enabled
enable_dl       =  Disabled
file_uploads        =  Enabled
max_execution_time  = 600
max_input_time  = 400
max_input_vars  = 10000
memory_limit        = 128M
session.save_path   = (blank)
upload_max_filesize = 2M

asked Sep 21, 2018 at 19:17

8

From a WordPress perspective, there's not a lot to configure for performance. You can set define( 'WP_DEBUG', false ); in your wp-config.php to disable logging, which will gain you some minimal savings.

Beyond that, I would recommend working on making sure your heavier plugins are optimized as best as you can, reduce the number of requests if possible, and optimize your queries.

You can take a look at plugins like Debug Bar to get an idea of what may be taking up the most resources on any given request, and services like New Relic can provide deeper insights to what's going on with your server in general.

answered Sep 21, 2018 at 19:35

Best php configuration for wordpress

phatskatphatskat

2,9591 gold badge15 silver badges26 bronze badges

Unless you have a compelling reason (for example: IP geolocation, heavy use of dynamic membership features) to process each request with PHP, you need a static HTML caching plugin to maintain decent performance on a shared hosting plan.

Here are a couple popular plugins to generate static HTML in no particular order:

  • W3 Total Cache
  • WP Fastest Cache

Static HTML caching will take most of the CPU load and memory usage out of the picture - there may still be a need to optimize front-end performance (image optimization, Javascript and CSS minification, etc), however, you'll find configuration options for some of these features in the plugins I mentioned (recommend a quick review of the documentation) and specialized plugins for image optimization.

Note: Just came across another free plugin which does things a little differently - if your site does not allow user registration or rely upon dynamic functionality, you'd probably be happiest with WP Static Site Generator (which aims to obviate any need for PHP parsing or database overhead).

answered Sep 21, 2018 at 20:36

GrayGray

3241 silver badge6 bronze badges

Servers power the internet by storing data files for websites, apps, and various digital assets. Any self-hosted WordPress website requires a server to store and use PHP files, media elements, databases, and content.

But did you know there are WordPress PHP and server requirements you have to consider before installing a WordPress site?

WordPress PHP and server requirements are the minimum environmental settings to produce a well-working website. WordPress can technically function on outdated code and servers, but it’s not ideal; things may break, and your site will run slower. That’s why WordPress lists requirements for both the server and PHP code. While this covers some liabilities on their end, it also tells developers that these are the server-level necessities to minimize problems when launching a hosted WordPress site.

In this guide, we’ll detail WordPress PHP and server requirements, along with optional recommendations, to create an ideal environment. We’ll also provide information on how to check your current server and PHP versions, and update them based on WordPress PHP requirements.

Keep reading to check it out!

Does WordPress Always Require a Server?

Yes, all WordPress websites need servers to function. It doesn’t matter whether you’re using WordPress.org or WordPress.com.

WordPress.org is self-hosted, giving you the most control over the server. Although WordPress.com doesn’t require you to self-host, WordPress.com still uses a physical server, and web server software, to host website files.

It’s generally recommended that developers stick to WordPress.org with a host like Kinsta. That way, you gain the benefits of a managed WordPress host (with features like automated backups, performance monitoring, and a content delivery network) while maintaining control over the server in your control dashboard. It’s beneficial to have a dashboard like this to create/move websites, configure speed and security settings, and analyze metrics for visits, PHP, and the website database.

Did you know there are WordPress PHP and server requirements you have to consider before installing a WordPress site? 😮 Find them all here 🤓Click to Tweet

WordPress PHP and Server Requirements

PHP is a programming language, and all mainstream programming languages get updated for improvements. In this case, we’re looking at which version of the PHP programming language is most suitable to run a WordPress site.

A web server, on the other hand, is a piece of software stored on a physical hardware server. Popular server software like Apache and Nginx require regular updates; so does the hardware on which the software gets placed. Therefore, developers must understand which versions of each perform best for WordPress.

We’ll start with the PHP requirements below, then move on to server requirements.

WordPress PHP Requirements

WordPress supports and runs on many versions of the PHP programming language. Yet, for the best performance, we recommend running PHP version 7.4 or higher.

That includes:

  • PHP Version 7.4
  • PHP Version 8.0
  • PHP Version 8.1

WordPress recommends PHP versions based on whether those releases still receive support from the developers of PHP. All PHP releases receive support for two years, after which they get moved into what’s called the “End of Life” stage.

PHP versions have three stages for support:

  • Active Support
  • Security Fixes Only
  • End of Life

During the “Active Support” phase, bugs and security reports get addressed and fixed. They also release sub-versions to refine the primary version during this time. Releases come out during the “Security Fixes Only” stage when it’s absolutely necessary to resolve an extreme security issue. The “End of Life” stage is when the PHP development team no longer provides security and bug fixes, meaning your website is open to vulnerabilities if it uses an “End of Life” version of PHP.

Because of these stages, it’s recommended that you immediately upgrade any website with a PHP version in the “End of Life” phase. Our recommendations from above have two PHP versions in the “Active Support” stage. PHP Version 7.4 is in the “Security Fixes Only” stage, making it the bare minimum you’d want for running a WordPress site.

Best php configuration for wordpress
Supported PHP releases and their phases.

The history of PHP versions dates back to October 2000 with PHP 3.0. Since then, we’ve seen regular updates going all the way to 8.1. The 7.3 version of PHP is the most recent to go in the “End of Life” stage, marking it unsupported for future fixes.

WordPress technically works with many PHP versions, some of them antiquated. It’s entirely possible to launch a WordPress site with PHP 3.0, but that’s bound to produce severe functionality and security issues. And although you’re fine with any “Security Fixes Only” version, it’s always best to update your WordPress site’s PHP to the most recent “Active Support” version.

How to Find and Update Your WordPress PHP Version

We recommend bookmarking the Supported Versions page from PHP.net to see version release dates, along with when “Active Support” and “Security Fixes Only” stages end for each version. Kinsta also has a PHP versions page to monitor supported releases.

The most important part of this is to know the current PHP version used by your website (and to update its PHP when necessary). Our best suggestions include looking at the Admin section of WordPress, checking the frontend, examining the version.php file, or using WP-CLI.

WordPress Server Requirements

Server requirements involve several elements: RAM, database version, processing power, disk space, and the web server used.

Here’s a quick look into the standard recommendations for a server when running WordPress:

  • Web server: Nginx or Apache with mod-rewrite module
  • Disk space: At least 1 GB
  • PHP: Version 7.4 or higher
  • Database: MySQL 5.015 or higher (An alternative is MariaDB, version 10.1 or higher)
  • RAM (Random Access Memory): At least 512 MB
  • CPU (Central Processing Unit): At least 1.0 GHz
  • Support for HTTPS

Now let’s take a deeper look into the reasoning behind these hardware and web server recommendations.

1. Web Server

There are various server types, but a web server often refers to a piece of software, hardware, or both working together. In most web hosting cases, the term “web server” blurs the definition, seeing as how your site files often get stored on a powerful, physical, computer-based web server. Those site files get accessed and delivered with a software web server.

Are there hardware and software web server requirements for WordPress?

Hardware Web Server Requirements and Recommendations

It doesn’t matter which brand of machine your host uses for hosting WordPress sites. Some hosts prefer Windows, while others opt for macOS or Linux computers. You can learn how to install PHP on any Windows, macOS, or Linux server.

More important is the hardware’s processing power, disk space, and RAM, which we’ll cover in the following sections. You’ll also want to ensure your host upgrades its hardware regularly (like everything, old machines break down), has cooling systems in its data center, and implements physical security measures to prevent intrusion into the data center.

You can usually find information about machines, server providers, and locations on your host’s website. Kinsta uses Google Cloud Platform, which manages a global network of secure, efficient data centers.

Software Web Server Requirements and Recommendations

The software side of a web server takes the data stored in a data center machine and delivers it to users who want to view or manage it. It’s how your WordPress website content gets presented to visitors, and how you gain access to server data on your own dashboard, like in MyKinsta.

WordPress recommends Nginx or Apache as the optimal web server software options for running WordPress. It’s not required to use either, although they each have their advantages. You can technically use any web server for WordPress.

Best php configuration for wordpress
Nginx is one of the suitable web server software for WordPress.

However, WordPress recommends Apache because of its name recognition, customization potential, and reliability. Nginx, meanwhile, offers powerful advantages over alternatives because of its ability to optimize performance through isolated containers, privatize server resources, and offer higher performance through improved caching, resource handling, and firewall implementation.

Kinsta uses Nginx as part of its web server solution to package all performance-optimizing aspects into individual containers. That way, all the resources like Nginx, Linux, and PHP are in one place.

You can optimize your WordPress site all you want, but the most significant performance boost comes from the web server and the hardware on which that web server lives. It’s possible to manage your own on-location server, but it’s far more common to opt for a server provider (a third-party company with data centers filled with the hardware needed to host web servers). Server providers include Google Cloud Platform, AWS (Amazon Web Services), and Rackspace.

These providers offer efficient, secure data centers and exceptional server power. However, server providers sell their servers as unmanaged hosting environments. That’s why it’s best to use an option like Kinsta to access Google Cloud Platform’s server power with the user-friendliness and added server management features of MyKinsta.

Want to know how we increased our traffic over 1000%?

Join 20,000+ others who get our weekly newsletter with insider WordPress tips!

Subscribe Now

2. Disk Space

Server hardware contains a certain amount of space on a hard disk. The WordPress application has a minimum disk space requirement of 1 GB. That’s incredibly low, so you shouldn’t have trouble finding a server with enough disk space to support WordPress.

Disk space comes into question when you add resources to the core WordPress application. All data files (like themes, plugins, and media) take up disk space. The hard disk then acts as a storage unit, determining how fast the processes and data get loaded to the CPU.

It’s often assumed that processing speed is the most important factor behind server performance, but the processor dictates the speed and quantity of calculations on the server. Although processing is crucial to your site performance, a high-quality hard disk is just as important.

The type of disk and its storage space requirements depend on the growth potential of your WordPress site. A media-heavy website with a constantly growing collection of blog posts and product pages requires more disk space. A personal blog with some small images can get by with low disk space levels. Therefore, you choose disk space size based on what you need. Kinsta offers SSD storage starting at 10 GB and going to 250 GB. Disk space overage options help to keep your sites running even if you go over limits.

The type of hardware used controls the hard disk’s performance. Hosts and server providers usually install hard disk drives (HDD) or solid-state drives (SSD) within the physical servers.

Here’s how they differ:

  • SSD: This is a modern, high-speed hard disk with no moving parts (solid-state), making it less susceptible to physical damages. The solid-state build of an SSD also results in faster data transmission, since there’s no need to wait for mechanisms to move around for the transfer. Because of these advantages, SSDs are more expensive than HDDs.
  • HDD: This is an older, cheaper hard disk with internal mechanical components that move. It’s ideal as an economical solution for storing data that are not needed regularly, or for data that requires less speed.

Some hosting providers opt to store databases on SSDs while placing other, potentially less important assets on HDDs. This makes for a compromise between price and performance.

Although WordPress works fine on an HDD, it’s wise to use servers with SSDs to ensure reliable data delivery, efficient processing, and open avenues for website growth.

3. Database

For database software, WordPress functions best with MySQL version 5.6+ or MariaDB version 10.1+.

Best php configuration for wordpress
MySQL is one of the supported database software for WordPress.

It’s highly recommended to use these database-related best practices as well:

  • Have your database stored on a solid-state drive.
  • Opt for a host with automated database optimization.
  • Activate automated backups of your database (and for your entire site, for that matter).
  • Ensure that your server allows for a multi-user environment.

Kinsta offers MariaDB on the Google Cloud Platform, weekly MySQL optimization, automated DB backups, and a multi-user environment.

4. RAM (Random Access Memory)

Server performance relies heavily on random access memory. Situated as a link between the CPU and hard disk, RAM prepares whatever data comes from the hard disk and sends it off to the CPU (processor).

Servers take advantage of RAM because it’s much easier to access than the hard disk. So, higher RAM results in more data/processes being stored in the “waiting area” for the CPU to access when it’s done with the previous process. With this data “waiting area,” all server processing goes much faster.

The WordPress application by itself requires at least 512 MB of RAM. Increasing RAM makes sense for any growing WordPress site, whether for larger databases, media, or anything that needs processing.

Kinsta provides 8 GB of RAM for both standard plans and staging environments, with options to upgrade if you need it.

5. PHP and PHP Memory Limit

As previously mentioned in this article, we always recommend the most recent version of PHP when running a WordPress site. But what about the PHP memory limit?

PHP memory limits involve the amount of memory reserved for the web server to run PHP-based processes. The goal of the PHP memory limit is to remove the chances of RAM-hogging resources crashing your site. Hosting companies and server providers decide upon the PHP memory limit on your server, so you may need to speak with them to either increase or decrease the limit.

A standard WordPress installation operates well with 64 MB of PHP memory limit, but it’s not uncommon for hosts to offer up to 256 MB if needed.

WordPress is known for its ability to integrate with plugins, themes, and other apps, and sometimes, those extras need a little extra power. This is common with WordPress plugins that rely heavily on PHP memory.

Luckily, you can contact your host whenever you want to increase this limit.

6. CPU

The CPU, or central processing unit, is the processing chip within a hardware server. Often considered the command center of any server, the CPU decides how many processes can occur on the server, and how fast.

WordPress works just fine on a measly 1.0 GHz of CPU processing power. However, that’s assuming you have added nothing to the site. Most hosts don’t worry about processing power anymore. Still, they focus on how many processing cores are available, making it easier to figure out what’s needed (saying 5 cores is more understandable than saying 50 GHz).

Additionally, CPUs from hosts are so powerful that there’s not as much concern about RAM, especially when running a lightweight application like WordPress.

Having said that, RAM requirements vary based on the type of site built on WordPress. Processing refers to the server’s ability to multitask, which ties into the entire performance equation. The hard disk passes data to the CPU, and the RAM makes accessing that data from the CPU faster and easier.

However, the CPU is what processes the data. So, more CPUs make for improved performance. Two cores process twice as many actions as one core. And six cores process twice as many actions as three cores.

Therefore, a WordPress site with tens of thousands of users accessing multiple files at once should look into increasing the number of CPUs on its server.

Most hosting companies increase the number of CPUs as you move up in their pricing plans. For instance, Kinsta starts its standard plans with 12 CPUs, but you can upgrade if needed.

7. Bonus Recommendation: Server Location

It seems like server location shouldn’t matter with the rise of cloud hosting and virtual private servers. But with those hosting types, a server is still sitting somewhere in the world holding the contents of your WordPress site. The server has a physical location, making it further away from some users, and closer to others. This physical distance affects the loading speed of your WordPress site.

WordPress doesn’t require or recommend any particular server location to run its application, but we suggest going with a host with access to a global server network. With a global network, your website files get placed on the physical server of your choice, most likely the one that’s closest to your users. You would pick a server in the United States if most of your users are in the US. Or maybe you’d opt for a specific region, like the West or East Coast of the US, making for closer content delivery options to users.

In addition, we suggest finding a server with CDN (content delivery network) capabilities, allowing you to not only choose your server but take advantage of multiple servers on the network, speeding up WordPress site delivery times all over the world.

With Google Cloud Platform, Kinsta can offer 35 data center locations, including options in Australia, the UK, Switzerland, the US, Japan, Singapore, and many more; you’re free to choose which data center works best for your WordPress site. Furthermore, Kinsta provides a free CDN through Cloudflare to speed up content delivery and remove geographical boundaries between your server and users.

Best php configuration for wordpress
Kinsta’s server locations.

8. Bonus Recommendation: A Unique Server Account Username

Most servers have a default username that gets shared with all server users. Therefore, it’s recommended that you run a PHP application like WordPress with your own account username instead of sticking with the default username provided by your server. Contact your website host to make this change.

How to Check if a Web Host Supports WordPress PHP and Server Requirements

Sometimes a host lists information about its support of PHP and server requirements in its pricing plan details. The Kinsta Pricing page, for example, lists its support for the most recent version of PHP, along with information about its SSD storage, WordPress databases, performance, and even server locations from its use of the Google Cloud Platform. Kinsta also shares how it uses MariaDB on the Google Cloud Platform, LXD containers, and Nginx to offer a high-speed infrastructure of up-to-date servers, databases, and processing components.

If you’re developing a WordPress site using a different host, it’s best to contact customer support to figure out if the host (and the plan you’re paying for) supports WordPress PHP and server requirements.

You can ask with a simple message like this:

I’d like to host the open-source version of WordPress with (insert host company name). I’m writing to find out if my hosting plan supports the following requirements:

  • MariaDB 10.1 or higher, or MySQL 5.6 or higher
  • PHP version 7.4 or higher
  • Web server: Apache or Nginx with mod_rewrite module
  • Support for HTTPS

Thanks.

Learn more about WordPress PHP and server requirements, along with optional recommendations needed to create an ideal environment in this guide ✅Click to Tweet

Summary

WordPress PHP and server requirements are in place to protect your websites and to keep them functioning properly. That’s why it’s so important to find a host that supports all these requirements while also providing automated updates and dashboard tools to give you access to the server and PHP versions.

If you’re choosing a host, use the company’s pricing page to understand which packages support what your website needs. You can also email the host and ask them questions.

At Kinsta, we keep up with new server requirements, so you don’t have to worry about them. For currently running websites, you can monitor PHP versions in the WordPress and MyKinsta dashboards and take action to update to the most recent PHP whenever available.

What else should be considered when reviewing a host’s PHP and server offerings for a WordPress site? Let us know in the comments section.


Save time, costs and maximize site performance with:

  • Instant help from WordPress hosting experts, 24/7.
  • Cloudflare Enterprise integration.
  • Global audience reach with 35 data centers worldwide.
  • Optimization with our built-in Application Performance Monitoring.

All of that and much more, in one plan with no long-term contracts, assisted migrations, and a 30-day-money-back-guarantee. Check out our plans or talk to sales to find the plan that’s right for you.

ini which you may need for your PHP Parser..
short_open_tag = Off. ... .
safe_mode = Off. ... .
safe_mode_exec_dir = [DIR] ... .
safe_mode_allowed_env_vars = [PHP_] ... .
safe_mode_protected_env_vars = [LD_LIBRARY_PATH] ... .
disable_functions = [function1, function2...] ... .
max_execution_time = 30. ... .
error_reporting = E_ALL & ~E_NOTICE..

How do I change PHP settings in WordPress?

Activate the plugin through the Plugins menu in WordPress. You can now modify your php settings by going to the settings page located under wp-admin/tools. php? page=custom-php-settings.

How do I check my PHP config in WordPress?

Make sure the Web server is running, open a browser and type http://SERVER-IP/phptest.php. You should then see a screen showing detailed information about the PHP version you are using and installed modules.

How is PHP used in WordPress?

WordPress is written using PHP as the scripting language. Just like WordPress, PHP is also open source. PHP is a server side language, which means that it runs on your web hosting server. Whenever someone visits your website, their browser contacts your server to request the page.