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".
- 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
- Which server + PHP combo is most recommended for WordPress performance?
- Why should you remove
info.phpafter testing? - What command tests Apache configuration?
- What’s the difference between static and dynamic content?
- Which PHP modules are essential for WordPress?
Mini Quiz
| Task | Command |
|---|---|
| Check PHP version | php -v |
| List PHP modules | php -m |
| Restart Apache | systemctl restart apache2 |
| Restart Nginx | systemctl restart nginx |
| Restart OLS | systemctl restart lsws |
| Test Apache config | apache2ctl configtest |
| Test Nginx config | nginx -t |
| Firewall rule | ufw allow 'Apache Full' |
Cheat Sheet
Visit: http://your-server-ip:8088/test.php
# 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
| Issue | Cause | Fix |
|---|---|---|
| 500 error | PHP misconfig | Check php.ini + logs |
| PHP file download | PHP-FPM not linked | Fix fastcgi_pass in Nginx |
| Apache blank page | Wrong PHP mod | a2enmod php8.2 |
| OLS not starting | Port conflict | Stop Apache/Nginx or change port |
php not found | Package missing | sudo 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
- Use phpinfo() only for testing, then delete it.
- Prefer OpenLiteSpeed + LSCache for WordPress performance.
- Use
nginx -torapache2ctl configtestbefore restarting services. - Enable only required modules:
mysqli,curl,mbstring,gd,zip. - 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:
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'
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 8088/tcp
23. Firewall allow OLS ports
Use Case: Hard reset server. Benefit: Recover from errors.
Stopping OpenLiteSpeed...
Starting OpenLiteSpeed...
Output:
/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:
/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:
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:
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 "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:
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 -I "http://localhost:8088"
16. Test HTTP response
Output: Opens config file. Use Case: Change memory/upload limits. Benefit: Tune WordPress performance.
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 -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:
lsphp -m
13. Check loaded PHP modules
Use Case: Upgrade PHP quickly. Benefit: Stay up-to-date.
Switched to lsphp82 successfully.
Output:
/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:
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:
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 -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 -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:
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:
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:
systemctl stop lsws
5. Stop OpenLiteSpeed
Use Case: Apply configuration changes. Benefit: Reload without reboot.
● lsws.service - OpenLiteSpeed HTTP Server
Active: active (running)
Output:
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:
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:
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:
/usr/local/lsws/bin/lshttpd -v
1. Check OpenLiteSpeed version
Command reference with examples
| Command | Flag | Meaning | Example |
|---|---|---|---|
apache2ctl | configtest | Test Apache config | apache2ctl configtest |
nginx | -t | Test Nginx config | nginx -t |
systemctl | status | Show service state | systemctl status php8.2-fpm |
php | -v | Show PHP version | php -v |
php | -m | List loaded modules | php -m |
lsphp | -v | Show LiteSpeed PHP version | lsphp -v |
Common options and flags
Visit: http://your-server-ip/info.php
echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/info.php
PHP Info Test
systemctl status apache2
systemctl restart nginx
systemctl status lsws
Web Server Service Control
Mental model
| Layer | Responsibility |
|---|---|
| Web server | Accepts HTTP(S), serves static assets, and routes PHP requests |
| PHP runtime | Executes WordPress PHP and generates HTML |
| Database | Stores posts/users/options and responds to queries |
| Cache (optional) | Reduces repeated PHP/DB work (page and object cache) |
| Filesystem | Stores wp-content (uploads/plugins/themes) and logs |
| OS resources | CPU/RAM/disk/network set the upper performance limit |
Verify your stack quickly
PHP 8.2.12 (cli) (built: Sep 23 2025 14:01:17) (NTS)
Modules: mysqli, curl, gd, mbstring...
Expected Output:
php -v
php -m
dpkg -l | grep php
- Verify PHP installation:
# 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:
sudoorrootuser.
How to use this section
Use this page as a reference:
- Work through the quick labs when you're setting up a new VPS.
- Use the cheat sheet and troubleshooting matrix when something breaks under real traffic.
- Refer to the command examples when validating installs, ports, and service health.
- Compare stacks (Apache, Nginx, OpenLiteSpeed) based on how you plan to operate and scale.
- Keep the mental model in mind: web server + PHP + database + disk + network.
- Treat
phpinfo()and any test scripts as temporary diagnostics. - 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):
[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 -mis 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
- [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).
- Shows all extensions compiled into PHP or loaded via
- [Zend Modules]
- Shows special Zend Engine extensions, usually optimizers or cache engines.
- Example:
Zend OPcachespeeds up PHP execution by caching compiled code.
Modules that matter for WordPress
Here’s what some of the important ones mean (especially for WordPress):
| Module | Purpose in PHP/WordPress | Why Important |
|---|---|---|
mysqli / pdo_mysql | Connects WordPress to MySQL/MariaDB | Required for WordPress DB |
curl | Transfers data over HTTP/S | Used by plugins, APIs, WP updater, many plugins |
mbstring | Multibyte string handling | Helps with UTF-8 content and some plugin dependencies |
gd / imagick | Image processing | Thumbnails and image transforms |
intl | Internationalization | Locale-aware formatting; some multilingual plugins |
zip | ZIP archive support | Theme/plugin installs and some backup tools |
xml / xmlreader / xmlwriter | XML parsing | Feeds and some plugins |
json | JSON parsing | REST API and editor behavior |
redis | Object caching | Reduces database load when caching is configured |
opcache (Zend) | Opcode caching | Improves PHP performance by caching compiled code |
Quick checks
Run:
php -m | rg -n 'mysqli|pdo_mysql|mysqlnd'
Output:
mysqli
pdo_mysql
mysqlnd
Confirms MySQL extensions are enabled.
Why it matters for WordPress
- WordPress requires a database extension (
mysqliorpdo_mysql) and common runtime modules. - Plugins often require extras (
curl,zip,imagick/gd). - Performance modules like
opcache(and optionallyredis) 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).
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 withphpin 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 cachinglsphpXX-curl→ curl HTTP requestslsphpXX-igbinary,lsphpXX-msgpack→ cache serializerslsphpXX-imagick→ ImageMagick supportlsphpXX-mysql→ MySQLi/PDO MySQL supportlsphpXX-opcache→ OPcachelsphpXX-redis→ Redis cache supportlsphpXX-sqlite3→ SQLite database supportlsphpXX-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
- Installed PHP interpreters →
lsphp81,lsphp82,lsphp83,php8.3-cli. - Installed PHP extensions → mysql, redis, curl, imagick, etc.
- 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(orlsphp83if 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.