Skip to main content

Introduction

WordPress runs on a simple chain: your web server accepts requests, PHP generates pages, and the database stores state. If any link in that chain is misconfigured (wrong PHP handler, missing modules, broken SSL, bad ports), WordPress failures often look like "the site is down".

Quick Summary
  • Pick one primary stack and learn its control points (config file path, logs, reload command).
  • Validate configs before reload (nginx -t, apachectl configtest) to avoid self-inflicted outages.
  • Use SSL early; once HTTPS is working, you can safely enforce redirects.

Foundation: web server + PHP = WordPress engine


  1. Which server + PHP combo is most recommended for WordPress performance?
  2. Why should you remove info.php after testing?
  3. What command tests Apache configuration?
  4. What’s the difference between static and dynamic content?
  5. Which PHP modules are essential for WordPress?

Mini Quiz


TaskCommand
Check PHP versionphp -v
List PHP modulesphp -m
Restart Apachesystemctl restart apache2
Restart Nginxsystemctl restart nginx
Restart OLSsystemctl restart lsws
Test Apache configapache2ctl configtest
Test Nginx confignginx -t
Firewall ruleufw allow 'Apache Full'

Cheat Sheet


Visit: http://your-server-ip:8088/test.php

ols-cheat-sheet.sh
# Install OLS + PHP 8.2
sudo apt install openlitespeed lsphp82 -y

# Check OLS service
systemctl status lsws

# Create test PHP file
echo "<?php echo 'Hello WordPress Engine!'; ?>" > /usr/local/lsws/Example/html/test.php

Quick Lab


IssueCauseFix
500 errorPHP misconfigCheck php.ini + logs
PHP file downloadPHP-FPM not linkedFix fastcgi_pass in Nginx
Apache blank pageWrong PHP moda2enmod php8.2
OLS not startingPort conflictStop Apache/Nginx or change port
php not foundPackage missingsudo apt install php

Troubleshooting Matrix


  • Test page (info.php) loads.
  • Virtual host configured for domain.
  • Firewall allows HTTP/HTTPS.
  • PHP installed and verified (php -v).
  • Web server running (systemctl status).

Go-Live Checklist


  • Dynamic Content: WordPress pages → PHP generates HTML from DB.
  • Static Content: HTML, CSS, JS → Served directly by web server.

Static vs dynamic


  1. Use phpinfo() only for testing, then delete it.
  2. Prefer OpenLiteSpeed + LSCache for WordPress performance.
  3. Use nginx -t or apache2ctl configtest before restarting services.
  4. Enable only required modules: mysqli, curl, mbstring, gd, zip.
  5. Always install the latest PHP version supported by WordPress.

Best practices


  • PHP 8.2/8.3: Better performance, memory optimization, security.
  • OpenLiteSpeed: Modern, LSCache plugin, best for WordPress.
  • Nginx: High concurrency, reverse proxy support.
  • Apache: Stable, flexible, widely supported.

Benefits

Use Case: Confirm OLS bound to ports. Benefit: Ensure web traffic works.

tcp LISTEN 0 128 *:8088 *:*
tcp LISTEN 0 128 *:443 *:*

Output:

verify-ols-listening-ports.sh
ss -tuln | grep LISTEN | grep lsws

25. Verify OLS listening ports


Use Case: Open 80/443. Benefit: Production traffic enabled.

Rule added
Rule added (v6)

Output:

ufw-allow-openlitespeed-full.sh
ufw allow 'OpenLiteSpeed Full'

24. Firewall allow HTTP/HTTPS


Use Case: Enable default OLS web port. Benefit: Browser access to test page.

Rule added
Rule added (v6)

Output:

ufw-allow-ols-8088.sh
ufw allow 8088/tcp

23. Firewall allow OLS ports


Use Case: Hard reset server. Benefit: Recover from errors.

Stopping OpenLiteSpeed...
Starting OpenLiteSpeed...

Output:

lswsctrl-stop-start.sh
/usr/local/lsws/bin/lswsctrl stop
/usr/local/lsws/bin/lswsctrl start

22. Stop and start OLS manually


Use Case: Apply config safely. Benefit: No downtime reload.

Reloading OpenLiteSpeed succeeded.

Output:

lswsctrl-reload.sh
/usr/local/lsws/bin/lswsctrl reload

21. Reload OLS without full restart


Use Case: Review vhost setup. Benefit: Debug domain issues.

docRoot /usr/local/lsws/Example/html/
vhDomain example.com

Output:

view-example-vhost-conf.sh
cat /usr/local/lsws/conf/vhosts/Example/vhconf.conf

20. Inspect OLS vhost config


Use Case: Identify hosted sites. Benefit: Manage vhost configs.

Example
mydomain.com

Output:

list-ols-vhosts.sh
ls /usr/local/lsws/conf/vhosts/

19. List OLS virtual hosts


Use Case: Ensure PHP + OLS integration. Benefit: Confirms site readiness.

Hello WordPress Engine!

Output:

curl-test-php-page.sh
curl "http://localhost:8088/test.php"

18. Fetch PHP test page


Use Case: Confirm PHP works. Benefit: Quick environment check.

/usr/local/lsws/Example/html/test.php

Output:

create-test-php-file.sh
echo "<?php echo 'Hello WordPress Engine!'; ?>" > /usr/local/lsws/Example/html/test.php

17. Create PHP test file


Use Case: Confirm OLS is serving requests. Benefit: Verify connectivity.

HTTP/1.1 200 OK
Server: LiteSpeed

Output:

curl-head-localhost-8088.sh
curl -I "http://localhost:8088"

16. Test HTTP response


Output: Opens config file. Use Case: Change memory/upload limits. Benefit: Tune WordPress performance.

edit-lsphp-php-ini.sh
nano /usr/local/lsws/lsphp82/etc/php/8.2/litespeed/php.ini

15. Edit PHP configuration


Output: Full phpinfo() style config. Use Case: Inspect PHP environment. Benefit: Debug settings without browser.

lsphp-info.sh
lsphp -i | less

14. View PHP info in terminal


Use Case: Verify WordPress-required modules. Benefit: Prevent missing extension errors.

mysqli
curl
mbstring
gd
zip

Output:

list-lsphp-modules.sh
lsphp -m

13. Check loaded PHP modules


Use Case: Upgrade PHP quickly. Benefit: Stay up-to-date.

Switched to lsphp82 successfully.

Output:

lsup-switch-lsphp.sh
/usr/local/lsws/admin/misc/lsup.sh -f lsphp82

12. Switch PHP version (OLS Admin GUI shortcut)


Use Case: See available PHP builds. Benefit: Choose best version for WordPress.

lsphp74 lsphp80 lsphp82

Output:

list-installed-lsphp-versions.sh
ls /usr/local/lsws/lsphp*

11. List installed PHP versions


Use Case: Verify PHP engine. Benefit: Ensure WordPress compatibility.

lsphp 8.2.12 (built: Sep 23 2025 14:01:17)

Output:

check-lsphp-version.sh
lsphp -v

10. Check LiteSpeed PHP version


Use Case: Monitor traffic. Benefit: Track real-time requests.

127.0.0.1 - - [29/Sep/2025:10:10:10] "GET /index.php HTTP/1.1" 200

Output:

tail-ols-access-log.sh
tail -f /usr/local/lsws/logs/access.log

9. Check access logs


Use Case: Debug server errors. Benefit: Faster troubleshooting.

[INFO] [12345] Server started on port 8088.

Output:

tail-ols-error-log.sh
tail -f /usr/local/lsws/logs/error.log

8. Check OpenLiteSpeed logs


Use Case: Prevent OLS auto-start. Benefit: Save resources on dev servers.

Removed /etc/systemd/system/multi-user.target.wants/lsws.service

Output:

disable-lsws-on-boot.sh
systemctl disable lsws

7. Disable OpenLiteSpeed on boot


Use Case: Auto-start OLS after reboot. Benefit: Avoids downtime.

Created symlink /etc/systemd/system/multi-user.target.wants/lsws.service

Output:

enable-lsws-on-boot.sh
systemctl enable lsws

6. Enable OpenLiteSpeed on boot


Use Case: Temporarily shut down. Benefit: Maintenance window.

● lsws.service - OpenLiteSpeed HTTP Server
Active: inactive (dead)

Output:

stop-lsws.sh
systemctl stop lsws

5. Stop OpenLiteSpeed


Use Case: Apply configuration changes. Benefit: Reload without reboot.

● lsws.service - OpenLiteSpeed HTTP Server
Active: active (running)

Output:

restart-lsws.sh
systemctl restart lsws

4. Restart OpenLiteSpeed


Use Case: Start OLS after reboot. Benefit: Bring server online.

● lsws.service - OpenLiteSpeed HTTP Server
Active: active (running)

Output:

start-lsws.sh
systemctl start lsws

3. Start OpenLiteSpeed service


Use Case: Ensure OLS is running. Benefit: Detect downtime.

● lsws.service - OpenLiteSpeed HTTP Server
Active: active (running) since Mon 2025-09-29 09:00:00

Output:

status-lsws.sh
systemctl status lsws

2. Check OpenLiteSpeed service status


Use Case: Confirm OLS installed. Benefit: Verify correct build.

LiteSpeed/1.8.1 Open (build: Sep 20 2025)

Output:

check-lshttpd-version.sh
/usr/local/lsws/bin/lshttpd -v

1. Check OpenLiteSpeed version


Command reference with examples


CommandFlagMeaningExample
apache2ctlconfigtestTest Apache configapache2ctl configtest
nginx-tTest Nginx confignginx -t
systemctlstatusShow service statesystemctl status php8.2-fpm
php-vShow PHP versionphp -v
php-mList loaded modulesphp -m
lsphp-vShow LiteSpeed PHP versionlsphp -v

Common options and flags


Visit: http://your-server-ip/info.php

create-phpinfo-file.sh
echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/info.php

PHP Info Test

service-control-examples.sh
systemctl status apache2
systemctl restart nginx
systemctl status lsws

Web Server Service Control

Mental model


LayerResponsibility
Web serverAccepts HTTP(S), serves static assets, and routes PHP requests
PHP runtimeExecutes WordPress PHP and generates HTML
DatabaseStores posts/users/options and responds to queries
Cache (optional)Reduces repeated PHP/DB work (page and object cache)
FilesystemStores wp-content (uploads/plugins/themes) and logs
OS resourcesCPU/RAM/disk/network set the upper performance limit

Verify your stack quickly


example-php-version-and-modules.txt
PHP 8.2.12 (cli) (built: Sep 23 2025 14:01:17) (NTS)
Modules: mysqli, curl, gd, mbstring...

Expected Output:

verify-php-installation.sh
php -v
php -m
dpkg -l | grep php

  • Verify PHP installation:
install-webserver-and-php-examples.sh
# Apache + PHP
sudo apt update && sudo apt install apache2 libapache2-mod-php php -y

# Nginx + PHP-FPM
sudo apt update && sudo apt install nginx php-fpm -y

# OpenLiteSpeed + PHP 8.2 (recommended for WordPress performance)
sudo apt update && sudo apt install openlitespeed lsphp82 -y

  • Installed Packages: Depending on your stack.
  • Access Level: sudo or root user.

How to use this section


Use this page as a reference:

  1. Work through the quick labs when you're setting up a new VPS.
  2. Use the cheat sheet and troubleshooting matrix when something breaks under real traffic.
  3. Refer to the command examples when validating installs, ports, and service health.
  4. Compare stacks (Apache, Nginx, OpenLiteSpeed) based on how you plan to operate and scale.
  5. Keep the mental model in mind: web server + PHP + database + disk + network.
  6. Treat phpinfo() and any test scripts as temporary diagnostics.
  7. Document what you changed and how you verified it.

Outcome: you can install, validate, and debug the web server + PHP layer that powers WordPress.

Key concepts


PHP modules and packages

php -m lists the extensions loaded by the PHP binary you're running (typically the CLI). WordPress may run under a different PHP handler, so treat this as a baseline and verify your web runtime too.

Example output (CLI):

example-php-m-output.txt
[PHP Modules]
apcu
bcmath
bz2
calendar
Core
ctype
curl
date
dom
enchant
exif
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
igbinary
imagick
imap
intl
json
libxml
mbstring
msgpack
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
random
readline
redis
Reflection
session
SimpleXML
soap
sockets
sodium
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tokenizer
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache

What php -m shows

php -m is a CLI command that lists extensions loaded by the PHP binary you executed.

What is php -m?

  • php -m is a CLI command that lists all currently loaded PHP modules and extensions.
  • These modules extend PHP’s core functionality (e.g., connecting to MySQL, handling images, caching).
  • The output is divided into [PHP Modules] and [Zend Modules].

Output sections

  1. [PHP Modules]
    • Shows all extensions compiled into PHP or loaded via php.ini.
    • Each entry is a feature or library (e.g., mysqli, curl, gd).
  2. [Zend Modules]
    • Shows special Zend Engine extensions, usually optimizers or cache engines.
    • Example: Zend OPcache speeds up PHP execution by caching compiled code.

Modules that matter for WordPress

Here’s what some of the important ones mean (especially for WordPress):

ModulePurpose in PHP/WordPressWhy Important
mysqli / pdo_mysqlConnects WordPress to MySQL/MariaDBRequired for WordPress DB
curlTransfers data over HTTP/SUsed by plugins, APIs, WP updater, many plugins
mbstringMultibyte string handlingHelps with UTF-8 content and some plugin dependencies
gd / imagickImage processingThumbnails and image transforms
intlInternationalizationLocale-aware formatting; some multilingual plugins
zipZIP archive supportTheme/plugin installs and some backup tools
xml / xmlreader / xmlwriterXML parsingFeeds and some plugins
jsonJSON parsingREST API and editor behavior
redisObject cachingReduces database load when caching is configured
opcache (Zend)Opcode cachingImproves PHP performance by caching compiled code

Quick checks

Run:

check-mysql-extensions.sh
php -m | rg -n 'mysqli|pdo_mysql|mysqlnd'

Output:

example-mysql-extension-check.txt
mysqli
pdo_mysql
mysqlnd

Confirms MySQL extensions are enabled.

Why it matters for WordPress

  • WordPress requires a database extension (mysqli or pdo_mysql) and common runtime modules.
  • Plugins often require extras (curl, zip, imagick/gd).
  • Performance modules like opcache (and optionally redis) are a common baseline for fast sites.

In practice, php -m is a capabilities checklist for that PHP runtime.


Installed PHP packages (Debian/Ubuntu)

dpkg -l | rg php shows which PHP packages are installed on disk (not which one your web server uses).

example-dpkg-php-packages.txt
root@GC-SG-M16GB:~# dpkg -l | grep php
ii lsphp81 8.1.33-5+noble amd64 server-side, HTML-embedded scripting language (LSAPI binary)
ii lsphp81-apcu 5.1.27-2+noble amd64 APC User Cache for PHP
ii lsphp81-common 8.1.33-5+noble all Common files for packages built from the PHP source
ii lsphp81-curl 8.1.33-5+noble amd64 CURL module for PHP
ii lsphp81-igbinary 3.2.16-5+noble amd64 igbinary PHP serializer
ii lsphp81-imagick 3.8.0-5+noble amd64 Provides a wrapper to the ImageMagick library
ii lsphp81-imap 8.1.33-5+noble amd64 IMAP module for PHP
ii lsphp81-intl 8.1.33-5+noble amd64 Internationalisation module for PHP
ii lsphp81-msgpack 3.0.0-4+noble amd64 PHP extension for interfacing with MessagePack
ii lsphp81-mysql 8.1.33-5+noble amd64 MySQL module for PHP
ii lsphp81-opcache 8.1.33-5+noble amd64 Zend OpCache module for PHP
ii lsphp81-redis 6.2.0-4+noble amd64 PHP extension for interfacing with Redis
ii lsphp81-sqlite3 8.1.33-5+noble amd64 SQLite3 module for PHP
ii lsphp82 8.2.29-3+noble amd64 server-side, HTML-embedded scripting language (LSAPI binary)
ii lsphp82-apcu 5.1.27-1+noble amd64 APC User Cache for PHP
ii lsphp82-common 8.2.29-3+noble all Common files for packages built from the PHP source
ii lsphp82-curl 8.2.29-3+noble amd64 CURL module for PHP
ii lsphp82-igbinary 3.2.16-4+noble amd64 igbinary PHP serializer
ii lsphp82-imagick 3.8.0-4+noble amd64 Provides a wrapper to the ImageMagick library
ii lsphp82-imap 8.2.29-3+noble amd64 IMAP module for PHP
ii lsphp82-intl 8.2.29-3+noble amd64 Internationalisation module for PHP
ii lsphp82-msgpack 3.0.0-3+noble amd64 PHP extension for interfacing with MessagePack
ii lsphp82-mysql 8.2.29-3+noble amd64 MySQL module for PHP
ii lsphp82-opcache 8.2.29-3+noble amd64 Zend OpCache module for PHP
ii lsphp82-redis 6.2.0-3+noble amd64 PHP extension for interfacing with Redis
ii lsphp82-sqlite3 8.2.29-3+noble amd64 SQLite3 module for PHP
ii lsphp83 8.3.25-3+noble amd64 server-side, HTML-embedded scripting language (LSAPI binary)
ii lsphp83-apcu 5.1.27-2+noble amd64 APC User Cache for PHP
ii lsphp83-common 8.3.25-4+noble all Common files for packages built from the PHP source
ii lsphp83-curl 8.3.25-3+noble amd64 CURL module for PHP
ii lsphp83-igbinary 3.2.16-6+noble amd64 igbinary PHP serializer
ii lsphp83-imagick 3.8.0-5+noble amd64 Provides a wrapper to the ImageMagick library
ii lsphp83-imap 8.3.25-3+noble amd64 IMAP module for PHP
ii lsphp83-intl 8.3.25-3+noble amd64 Internationalisation module for PHP
ii lsphp83-msgpack 3.0.0-4+noble amd64 PHP extension for interfacing with MessagePack
ii lsphp83-mysql 8.3.25-3+noble amd64 MySQL module for PHP
ii lsphp83-opcache 8.3.25-3+noble amd64 Zend OpCache module for PHP
ii lsphp83-redis 6.2.0-4+noble amd64 PHP extension for interfacing with Redis
ii lsphp83-sqlite3 8.3.25-3+noble amd64 SQLite3 module for PHP
ii php-common 2:93ubuntu2 all Common files for PHP packages
ii php-mysql 2:8.3+93ubuntu2 all MySQL module for PHP [default]
ii php-readline 2:8.3+93ubuntu2 all readline module for PHP [default]
rc php8.3-cli 8.3.6-0ubuntu0.24.04.4 amd64 command-line interpreter for the PHP scripting language
ii php8.3-common 8.3.6-0ubuntu0.24.04.5 amd64 documentation, examples and common module for PHP
rc php8.3-curl 8.3.6-0ubuntu0.24.04.4 amd64 CURL module for PHP
rc php8.3-intl 8.3.6-0ubuntu0.24.04.4 amd64 Internationalisation module for PHP
rc php8.3-mbstring 8.3.6-0ubuntu0.24.04.4 amd64 MBSTRING module for PHP
ii php8.3-mysql 8.3.6-0ubuntu0.24.04.5 amd64 MySQL module for PHP
ii php8.3-opcache 8.3.6-0ubuntu0.24.04.5 amd64 Zend OpCache module for PHP
ii php8.3-readline 8.3.6-0ubuntu0.24.04.5 amd64 readline module for PHP
rc php8.3-zip 8.3.6-0ubuntu0.24.04.4 amd64 Zip module for PHP
root@GC-SG-M16GB:~#

What the command does

  • dpkg -l → lists all installed packages (from Ubuntu/Debian package manager).
  • | grep php → filters the list to show only packages with php in their name.

This is different from php -m (which shows loaded PHP extensions for a particular runtime).

dpkg -l | grep php shows which PHP packages are installed on the system.


What this output tells you

From your paste, I see:

  • You have multiple LiteSpeed PHP builds installed:
    • lsphp81 (PHP 8.1)
    • lsphp82 (PHP 8.2)
    • lsphp83 (PHP 8.3)
  • For each version, you also have extensions installed:
    • lsphpXX-apcu → APCu caching
    • lsphpXX-curl → curl HTTP requests
    • lsphpXX-igbinary, lsphpXX-msgpack → cache serializers
    • lsphpXX-imagick → ImageMagick support
    • lsphpXX-mysql → MySQLi/PDO MySQL support
    • lsphpXX-opcache → OPcache
    • lsphpXX-redis → Redis cache support
    • lsphpXX-sqlite3 → SQLite database support
    • lsphpXX-intl, lsphpXX-imap, etc. → specific feature extensions
  • You also have Ubuntu default PHP packages:
    • php8.3-mysql, php8.3-opcache, php8.3-mbstring, etc.
    • These are separate from LiteSpeed PHP (lsphp).

Why multiple PHP builds can coexist

  • lsphpXX → used by OpenLiteSpeed/LSWS (via LSAPI).
  • php8.3-XXX → Ubuntu’s default PHP build (used by CLI or Apache/Nginx if you had them).

Since you’re focusing on OpenLiteSpeed, the lsphpXX packages are the ones that matter for running WordPress.


How to interpret the package list

  1. Installed PHP interpreterslsphp81, lsphp82, lsphp83, php8.3-cli.
  2. Installed PHP extensions → mysql, redis, curl, imagick, etc.
  3. Multiple versions → you have PHP 8.1, 8.2, and 8.3 installed at the same time.

Key takeaway:

  • dpkg -l | grep php = "Which PHP packages (versions + extensions) are installed on my system?"

  • It doesn’t tell you which version is active — OpenLiteSpeed decides that in its Admin Web Console or configs.

  • For WordPress performance, the important ones are:

    lsphp82 (or lsphp83 if stable) + lsphpXX-mysql + lsphpXX-opcache + lsphpXX-redis + lsphpXX-imagick.


If you plan to remove packages, first identify which PHP runtime your web server is actually using and confirm it with a live request before uninstalling anything.