Blog · 8 Sep 2026 · 7 min read
How to Speed Up cPanel Hosting Website: Practical Guide
Learn practical cPanel optimizations to speed up your website, including PHP version upgrades, OPcache, MySQL query caching, and image compression techniques.
By Yoga
If your website feels sluggish on shared cPanel hosting, the good news is you have more control than you might think. Most hosts give you access to a surprising number of performance levers right inside cPanel, and many of them take less than five minutes to flip. This guide walks through concrete, actionable steps — no hand-waving, no vague advice.
1. Upgrade to the Correct PHP Version
One of the single highest-impact changes you can make is ensuring your site runs on a modern, supported PHP version. PHP 8.x is significantly faster than 7.x — benchmarks from the PHP core team consistently show 30–50% throughput improvements on real-world workloads.
How to Change PHP Version in cPanel
- Log in to cPanel and navigate to Software → Select PHP Version (sometimes labeled MultiPHP Manager depending on your host's configuration).
- Choose the highest version your application supports. For WordPress, PHP 8.2 or 8.3 is fully supported as of 2024.
- Click Apply or Set as Current.
- Test your site immediately — check for any plugin or theme incompatibilities.
Tip: If you maintain multiple domains, MultiPHP Manager lets you set PHP versions per domain rather than globally. Use this to upgrade one site at a time safely.
Which PHP Version Should You Use?
| PHP Version | Status | Recommended? |
|---|---|---|
| 7.4 | End of Life | ❌ No |
| 8.0 | End of Life | ❌ No |
| 8.1 | Security fixes only | ⚠️ Acceptable |
| 8.2 | Active support | ✅ Yes |
| 8.3 | Active support | ✅ Yes |
2. Enable OPcache for PHP
OPcache is a bytecode cache built directly into PHP. Without it, PHP recompiles your scripts on every single request. With it, compiled bytecode is stored in shared memory and reused — drastically reducing CPU time and response latency.
Enabling OPcache via cPanel
- In cPanel, go to Software → Select PHP Version.
- Click the PHP Extensions or PHP Options tab.
- Scroll to find
opcacheand tick the checkbox to enable it. - Save your changes.
Tuning OPcache in php.ini
cPanel allows you to customize php.ini values either through the PHP Options UI or by placing a .user.ini file in your document root. Here are recommended settings for a WordPress site:
; .user.ini — place in your public_html folder
opcache.enable=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=10000
opcache.revalidate_freq=60
opcache.save_comments=1
memory_consumption=128— allocates 128 MB of shared memory for the cache. Increase to 256 if you have a large codebase.max_accelerated_files=10000— sets how many PHP files can be cached simultaneously. WordPress with many plugins can exceed the default of 2000.revalidate_freq=60— checks for file changes every 60 seconds. In production this is fine; set to 0 only during active development.
After saving, use a tool like phpinfo() or the Opcache Status open-source script to confirm OPcache is active and the hit rate is above 90%.
3. Optimize MySQL / MariaDB Query Performance
Database slowness is often the invisible culprit behind a sluggish site. cPanel-hosted databases run on MySQL or MariaDB, and while you typically cannot edit the global my.cnf on shared hosting, there are still meaningful optimizations you control.
Add Indexes to Slow Queries
Run this SQL query to identify tables missing primary keys or indexes:
SELECT table_name, engine, table_rows
FROM information_schema.tables
WHERE table_schema = 'your_database_name'
ORDER BY table_rows DESC;
For WordPress, the wp_options table is a notorious bottleneck. Two specific indexes help dramatically:
-- Run in phpMyAdmin (accessible from cPanel)
ALTER TABLE wp_options ADD INDEX autoload_idx (autoload);
After adding the index, also clean up auto-loaded options with a plugin like WP-Optimize or by querying directly:
SELECT option_name, length(option_value) AS size
FROM wp_options
WHERE autoload = 'yes'
ORDER BY size DESC
LIMIT 20;
Delete or deactivate any plugins that are bloating this table with transient data.
Use a WordPress Object Cache
On shared hosting you typically cannot install Redis or Memcached at the server level, but you can use a file-based or APCu-based object cache. Plugins like W3 Total Cache (with disk-based object caching) or LiteSpeed Cache (if your host runs LiteSpeed) will cache database query results to disk, meaning repeat queries skip the database entirely.
Configure database query caching inside your chosen plugin's settings under Database Cache or Object Cache — enable it and set a cache expiry of 1–3 hours for mostly-static content.
4. Compress and Serve Images Efficiently
Images are almost always the largest assets on a page and the easiest to optimize. There are two distinct steps: compression at upload time and format conversion.
Step 1: Batch-Compress Existing Images
cPanel's File Manager does not include a built-in image optimizer, but you can use the command line via Terminal (available in newer cPanel versions) or SSH:
# Install jpegoptim and optipng via SSH (if your host allows it)
# Otherwise skip to the WordPress plugin method below
# Lossless JPEG compression
find ~/public_html -name "*.jpg" -exec jpegoptim --strip-all --max=85 {} \;
# Lossless PNG compression
find ~/public_html -name "*.png" -exec optipng -o5 {} \;
If SSH access or package installation is restricted, use a WordPress plugin instead. ShortPixel, Imagify, or Smush all offer bulk optimization of your existing media library from the admin dashboard without requiring shell access.
Step 2: Serve Modern Formats (WebP)
WebP images are 25–35% smaller than equivalent JPEGs with no perceptible quality loss. If your host runs LiteSpeed Web Server (many cPanel hosts do), LiteSpeed Cache can automatically convert images to WebP and serve them to compatible browsers with zero manual work.
If you're on Apache (the default on most cPanel servers), add the following to your .htaccess to serve pre-generated WebP files when available:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{REQUEST_FILENAME} \.(jpe?g|png)$
RewriteCond %{REQUEST_FILENAME}.webp -f
RewriteRule ^ %{REQUEST_URI}.webp [L,T=image/webp]
</IfModule>
This rule tells Apache: if the browser supports WebP and a .webp version of the image exists on disk, serve the smaller file automatically.
5. Enable Gzip Compression via .htaccess
Text-based assets — HTML, CSS, JavaScript, XML — are highly compressible. Enabling Gzip on your Apache server reduces transfer size by 60–80% for these file types.
Add this block to your .htaccess file (above the WordPress rewrite rules):
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml
AddOutputFilterByType DEFLATE text/css text/javascript
AddOutputFilterByType DEFLATE application/javascript application/json
AddOutputFilterByType DEFLATE application/xml application/xhtml+xml
AddOutputFilterByType DEFLATE image/svg+xml
</IfModule>
Verify it's working with GiftOfSpeed's Gzip test by entering your URL — you should see compression percentages of 60% or higher on HTML responses.
6. Leverage Browser Caching with Cache-Control Headers
Browser caching tells returning visitors to store static assets locally so they don't re-download them on every page load. Add this to .htaccess:
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType image/webp "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
ExpiresByType text/html "access plus 1 hour"
</IfModule>
Set images and fonts to long expiry periods (1 year) since they rarely change. Set HTML to a short period (1 hour) so content updates reach users promptly.
Pulling It All Together
Here's a quick priority checklist to work through in order of impact vs. effort:
- PHP version — upgrade to 8.2 or 8.3 (5 minutes, highest impact)
- OPcache — enable and tune via
.user.ini(10 minutes) - Database indexes — add the
wp_optionsautoload index (5 minutes) - Object caching — configure disk-based caching in your performance plugin (15 minutes)
- Image compression — bulk-optimize with ShortPixel or Imagify (30 minutes, one-time)
- Gzip — add
mod_deflaterules to.htaccess(5 minutes) - Browser caching — add
mod_expiresrules to.htaccess(5 minutes)
Most of these changes require nothing more than cPanel access and a text editor. After applying them, run your site through Google PageSpeed Insights or GTmetrix before and after to measure the real-world difference.
If you're looking for cPanel hosting that gives you full access to PHP version management, SSH, and .htaccess control out of the box, GoCelerus shared hosting plans are built to support exactly this kind of hands-on optimization without restrictions.