Installing PHP and WordPress Requirements on Hosting

Advertising

Installing PHP and WordPress Requirements on Hosting

Check your required PHP version for WordPress

You need to know your PHP version because it affects security, performance, and plugin compatibility. WordPress and many plugins now expect PHP 8.0 or higher, so running an old release can break features or leave vulnerabilities. Before you change anything, back up your site and database so you can roll back if a theme or plugin misbehaves.

Check your hosting docs and the WordPress dashboard to see the required version. Some plugins list a minimum in their readme or on the plugin page. If your host still offers PHP 7.x, plan a staged upgrade: test on a clone, then push to live. Switching PHP in your control panel or asking support to help is part of installing PHP and WordPress requirements on hosting and keeps your site healthy. After switching, check pages, admin screens, and key plugins; log what you changed and when so you can trace problems quickly.

How to find the required PHP version

Open your WordPress admin and go to Tools → Site Health → Info → Server to see your current PHP version and PHP settings. If you have SSH access, run php -v to see the CLI version (web PHP can differ). Also check plugin and theme docs for version notes, and ask your host which PHP versions they support and how to switch.

Why newer PHP helps site speed

Newer PHP releases run code faster and use less memory. Features such as opcache and internal optimizations cut page build time and reduce server load. Faster PHP means pages generate quicker, which helps visitors and search rankings. Upgrading PHP is one of the simplest wins for performance.

Verify version with phpinfo()

Create a file named phpinfo.php with:
php

Open it in the browser to see the full phpinfo() output and exact PHP version, then delete the file right away to avoid exposing server details.

Advertising

Install PHP on your hosting

Getting PHP set up is the first step to run WordPress. Start by checking your hosting control panel or support docs for which PHP versions they offer and pick one that matches your theme and plugins—preferably PHP 8.0 or higher. There are two main ways to install: a one-click installer in the control panel or a manual install via SSH. The control panel is faster and safer for most users; SSH gives more control but requires comfort with commands and configuration files. This is a key part of Installing PHP and WordPress Requirements on Hosting.

Use hosting control panel installers

If your host offers Softaculous, cPanel, or Plesk, use that installer. You click a few options, choose the PHP version, and the system sets files and permissions for you. Watch for optional settings during install: pick the right PHP version, enable common extensions, and check php.ini values like memory_limit. If something’s missing later, you can usually enable modules in the same panel or ask support.

Choose PHP handler (FPM or CGI)

The PHP handler decides how PHP runs on the server. PHP-FPM (FastCGI Process Manager) handles requests in pools and is faster for busy sites. CGI is older and can be slower; it’s fine for tiny sites but not ideal for growth. For most WordPress sites, pick FPM for better performance and tunability.

Pick PHP packages needed for WP

Enable common extensions so themes and plugins run without errors, for example:

  • mysqli or pdo_mysql
  • curl
  • mbstring
  • xml
  • json
  • zip
  • gd or imagick
  • fileinfo
  • openssl

Missing an extension often causes a plugin to fail.

Enable PHP extensions for WordPress

PHP extensions are tools: some let WordPress talk to the database, some handle multi-byte text, and some call external services. Skipping them will make plugins fail or pages break, so check this early when you set up your site. This is part of Installing PHP and WordPress Requirements on Hosting and getting it right saves wasted time later.

Common extensions: mysqli, mbstring, curl

  • mysqli lets WordPress talk to MySQL/MariaDB; without it WordPress can’t read or write content.
  • mbstring handles multi-byte text (emoji, non-Latin scripts); missing it can cause broken characters.
  • curl lets your site fetch external data (APIs, remote images); many plugins rely on it.

How to enable extensions in cPanel or CLI

In cPanel, go to Select PHP Version or PHP Extensions, pick the PHP version, check boxes for mysqli, mbstring, curl, etc., and save. On a server CLI, install or enable extensions with the package manager or PECL, then edit php.ini if needed. After installing, restart php-fpm or apache/nginx. Keep track of which PHP version you’re changing so you enable extensions for the correct runtime.

Confirm extensions with phpinfo()

Load phpinfo() in your browser and search for mysqli, mbstring, and curl to confirm they are active. The page shows the exact PHP version, loaded extensions, and ini settings.

Configure php.ini for WordPress

The first file you touch when Installing PHP and WordPress Requirements on Hosting is php.ini. It controls PHP limits that affect uploads, memory, and script time. If ignored, media uploads can fail, imports hang, and plugins throw errors. Back up the original before changing anything, edit with plain text, save, and test.

Don’t forget security and performance when changing settings—raising a value helps one task but can open a resource hole if set too high. Use phpinfo() or your host panel to confirm the active values. On shared hosting some limits may be locked by the provider.

Key settings to edit like uploadmaxfilesize

Start with:

  • uploadmaxfilesize and postmaxsize — set postmaxsize larger than uploadmaxfilesize (example: uploadmaxfilesize = 64M, postmaxsize = 68M).
  • memory_limit — set to at least 128M (better 256M for heavy plugins).
  • maxexecutiontime — increase to 60 or 120 seconds for long imports/backups.
  • maxinputvars — raise above 3000 if themes/plugins use many settings.

Change, save, and test by uploading or running the task that failed.

Where to place custom php.ini or .user.ini

On many hosts you can place a custom php.ini in your site root or publichtml. If your host uses PHP-FPM or FastCGI, use a .user.ini instead. If using Apache with modphp, PHP directives can be in .htaccess (won’t work with FPM). Run phpinfo() to see which configuration file is loaded. If your provider forbids per-site overrides, ask support to apply changes.

Apply changes by restarting PHP-FPM or Apache

After editing, restart PHP so new values take effect — e.g. systemctl restart php8.1-fpm or systemctl restart apache2. On shared hosting you may need to wait or request a reload from support.

Set PHP memory limit for WordPress

When Installing PHP and WordPress Requirements on Hosting, set the PHP memory limit so your site runs smoothly. Low memory makes plugins crash and pages act slow. Increase memory_limit only as needed; too much can hide badly coded plugins. Note the old value so you can roll back.

Recommended limits (128M to 256M)

  • 128M — safe baseline for simple blogs and small shops.
  • 256M — better for page builders, backups, and many plugins. If you still hit limits after 256M, investigate plugin bloat or upgrade your plan.

How to set memory_limit in php.ini or wp-config.php

In php.ini:

memory_limit = 256M

In WordPress wp-config.php (site-only):
php
define(‘WPMEMORYLIMIT’, ‘256M’);
define(‘WPMAXMEMORY_LIMIT’, ‘256M’); // for admin tasks

After changing, restart PHP/web server and test.

Check memory via WordPress health tool

Open Tools → Site Health and check the Server tab to see PHP memory_limit. If the number doesn’t change, your host likely locks PHP settings and you’ll need support help.

Update PHP version via hosting control panel

When you update the PHP version through your hosting control panel, you keep your site fast and secure. Most panels provide a per-domain selector. Pick the target PHP version, apply it, and test on staging first if possible. Plan the update for low-traffic hours and have a rollback plan.

After switching, check key PHP settings (memorylimit, maxexecution_time) and required extensions. If you need custom settings, add them to php.ini, .user.ini, or the panel’s custom fields and restart services if required.

Backup your site before updating PHP

Create a full backup of files and the database (hosting backup tool, plugin, or manual dump). Download an off-server copy and label it with the date. If possible, test the backup restore on staging so you’re prepared.

How to switch PHP versions in control panels

  • cPanel: use Select PHP Version or MultiPHP Manager.
  • Plesk: open PHP Settings for the domain and pick the version. After switching, check extensions and critical settings, restart services if prompted, and move to testing.

Test plugins and themes after update

Test core flows: front page load, admin login, form submissions, and checkout. Enable WP_DEBUG if errors appear and scan error logs. If a plugin or theme breaks, deactivate it, check for updates, or roll back the PHP version while you fix compatibility.

WordPress server requirements overview

You need a server that keeps your site fast and reliable. Pick a host that supports PHP, MySQL or MariaDB, and lets you run a modern PHP version. If the host allows control over PHP settings, you can raise memory limits and tweak timeouts so plugins and themes behave well. Look for hosts that advertise HTTP/2 or HTTP/3, SSL support, and easy backups.

Web server options: Apache or Nginx

  • Apache: works well with .htaccess and many WordPress plugins; easier for plugin compatibility and quick tweaks.
  • Nginx: more memory-efficient and better at handling large numbers of visitors; may require additional configuration for some plugins.

PHP MySQL/MariaDB basics for WordPress

WordPress runs on PHP with data stored in MySQL or MariaDB. Use a modern PHP version for speed and security, keep the database on the same host or fast network link, and give the DB user only necessary privileges. Ensure PHP extensions like curl, mbstring, openssl, and mysqli or pdo_mysql are enabled.

Compare minimum and recommended specs

  • Minimum: PHP 7.4, MySQL 5.7 / MariaDB 10.3, 128–256 MB PHP memory.
  • Recommended: PHP 8.0 (8.1/8.2 ideal), MySQL 8.0 / MariaDB 10.5, 512 MB–1 GB PHP memory, HTTPS, HTTP/2 or HTTP/3.

Database setup MySQL / MariaDB for WordPress

You need a solid database. Create a separate database for each site, use utf8mb4 charset for full Unicode/emoji support, and a dedicated DB user with limited privileges. Plan for backups and test restores.

Create database and a strong DB user

Create the DB via control panel or SQL and set utf8mb4 charset:
sql
CREATE DATABASE sitedb CHARACTER SET utf8mb4 COLLATE utf8mb4unicode_ci;

Add a DB user with a strong password and grant only needed privileges (SELECT, INSERT, UPDATE, DELETE). Avoid using root or shared accounts; store credentials in a password manager.

Choose utf8mb4 collation for WordPress

Use utf8mb4unicodeci so your site stores emoji and all languages correctly. For existing databases, back up first, then alter database and tables:
sql
ALTER DATABASE sitedb CHARACTER SET = utf8mb4 COLLATE = utf8mb4unicodeci;
ALTER TABLE table
name CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4unicodeci;

Test thoroughly after changes.

Add DB details to wp-config.php

Set DBNAME, DBUSER, DBPASSWORD, DBHOST, DBCHARSET, and DBCOLLATE in wp-config.php. Keep the file secure with proper file permissions.

WordPress file permissions and enable mod_rewrite

Treat file permissions as keys: wrong permissions make the site either locked out or wide open. The web server user (often www-data, apache, or nginx) should own WordPress files so updates and uploads work. Set directories to 755 and files to 644; tighten wp-config.php to 600 or 640 where possible. Never use 777.

Enable mod_rewrite for pretty permalinks and ensure Apache allows .htaccess overrides or configure rewrite rules for Nginx. After changes, restart the web server and test permalinks.

Correct file ownership and permission values

Common commands:

  • Debian/Ubuntu: chown -R www-data:www-data /path/to/wordpress
  • CentOS: chown -R apache:apache /path/to/wordpress Set directories to 755 and files to 644. For wp-config.php, use 600 or 640. If WordPress can’t write, fix ownership rather than giving 777.

Enable mod_rewrite for pretty permalinks on Apache

On Debian/Ubuntu:
bash
a2enmod rewrite
systemctl restart apache2

Ensure AllowOverride All is set for your site directory in the virtual host file so .htaccess rules can run. Then go to WordPress → Settings → Permalinks and save to update .htaccess. If WordPress can’t write the file, copy the shown rules into .htaccess and fix permissions.

Fix common permission and rewrite errors

  • 403 Forbidden: wrong ownership or directory set to 700; set directories to 755 and files to 644 and ensure web server user owns files.
  • 404 on permalinks: mod_rewrite not active or AllowOverride set to None; enable the module and set AllowOverride All.
  • 500 errors: bad .htaccess syntax or overly open permissions; check Apache error log and correct the file or reset permissions.

Installing PHP and WordPress Requirements on Hosting — Quick Checklist

  • Back up files and database (download an off-site copy).
  • Check current PHP version: Tools → Site Health → Server and phpinfo().
  • Choose PHP 8.0 where possible and pick PHP-FPM.
  • Enable required extensions: mysqli / pdo_mysql, curl, mbstring, xml, json, zip, gd/imagick, fileinfo, openssl.
  • Set memorylimit (128M baseline, 256M for heavier sites), uploadmaxfilesize, postmaxsize, maxexecutiontime, maxinput_vars.
  • Place custom php.ini or .user.ini in site root if allowed; restart PHP-FPM or web server.
  • Create DB with utf8mb4 and a dedicated DB user with limited privileges; add details to wp-config.php.
  • Set correct file ownership and permissions; enable mod_rewrite and confirm permalinks.
  • Test on staging, update PHP in low-traffic windows, and verify plugins/themes post-update.

Following these steps for Installing PHP and WordPress Requirements on Hosting will keep your site secure, fast, and compatible with modern plugins and themes.