How to Speed Up Your cPanel Hosting Website (Practical Guide)
By Yoga · 18 Aug 2026 · 2 min read
If your website feels sluggish, the problem is almost always fixable at the server or application level — and cPanel gives you more control than most people realize. This guide walks you through concrete, actionable steps to speed up your cPanel hosting website without needing to touch a command line or hire a sysadmin.
1. Upgrade to the Latest Stable PHP Version
PHP version alone can be one of the biggest performance levers available in cPanel. Each major PHP release comes with measurable speed improvements:
| PHP Version | Performance Notes |
|---|---|
| PHP 7.4 | ~3x faster than PHP 5.6 |
| PHP 8.0 | JIT compiler introduced |
| PHP 8.1 | Fibers, ~23% faster than 8.0 in benchmarks |
| PHP 8.2+ | Readonly classes, further JIT improvements |
How to Change PHP Version in cPanel
- Log in to your cPanel dashboard.
- Navigate to Software → Select PHP Version (or "MultiPHP Manager" on WHM-based hosts).
- Select your domain and choose the latest stable PHP version (8.2 or 8.3 at time of writing).
- Click Apply.
Important: Before switching, test your site on a staging environment. Some older plugins or themes may not be fully compatible with PHP 8.x. Check compatibility using the PHP Compatibility Checker plugin if you run WordPress.
After upgrading, run a simple benchmark using a tool like k6 or even browser DevTools to compare Time to First Byte (TTFB) before and after.
2. Enable OPcache for PHP Acceleration
Every time PHP processes a script, it compiles the source code into bytecode. Without caching, this happens on every single request — even when the code hasn't changed. OPcache stores compiled bytecode in shared memory so PHP can skip re-compilation.
Enabling OPcache via cPanel
- Go to Software → Select PHP Version.
- Click on PHP Extensions or PHP Options.
- Look for
opcachein the extension list and check the box to enable it. - Save changes.
Recommended OPcache Settings
Once enabled, you can fine-tune OPcache behavior via a custom php.ini file or .user.ini in your document root:
opcache.enable=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.revalidate_freq=60
opcache.fast_shutdown=1
memory_consumption: How much RAM (MB) OPcache can use. 128 MB is a safe default for shared hosting.max_accelerated_files: Maximum number of PHP files to cache. For WordPress sites with many plugins, 10,000 is a good starting point.revalidate_freq: How often (in seconds) PHP checks if a cached file has changed. Set higher on production, lower on development.
To confirm OPcache is running, create a file called opcache_status.php in your public directory:
<?php
$status = opcache_get_status();
echo '<pre>' . print_r($status, true) . '</pre>';
Visit the URL in your browser and verify opcache_enabled shows true. Delete this file after checking — it exposes server internals.
3. Optimize MySQL Query Performance
Slow database queries are one of the most common causes of a slow website, especially for WordPress, WooCommerce, or any CMS-driven site.
Enable MySQL Query Cache (If Available)
On some shared hosting environments, the MySQL Query Cache is already configured by the host. However, you can optimize at the application level regardless.
Identify Slow Queries Using WordPress Debug Logs
If you're running WordPress, install the Query Monitor plugin. It shows you:
- How many database queries each page load triggers
- Which queries are taking the longest
- Which plugins are responsible for bloated queries
A healthy WordPress page should run fewer than 50 queries per load. If you're seeing 100+, you have a plugin or theme problem — not a hosting problem.
Use a Persistent Object Cache
cPanel hosting typically runs PHP as a persistent process or CGI, and some providers offer Redis or Memcached as add-ons. A persistent object cache stores the results of expensive database queries in memory so they don't need to re-run on every page load.
For WordPress, install the Redis Object Cache plugin and connect it to a Redis instance if your host supports it. If Redis is unavailable, use a file-based object cache via a caching plugin like W3 Total Cache with "Database Cache" enabled.
Add Database Indexes for Custom Tables
If you run custom plugins or a custom application, make sure your most-queried columns are indexed. Connect via phpMyAdmin in cPanel:
-- Check if an index exists
SHOW INDEX FROM wp_postmeta;
-- Add a composite index if missing
ALTER TABLE wp_postmeta ADD INDEX meta_key_value (meta_key, meta_value(20));
Be careful with indexes on very large tables — adding an index locks the table briefly. Do this during low-traffic windows.
4. Compress and Optimize Images Before Upload
Images are typically 60–80% of a webpage's total byte size. Unoptimized images are one of the easiest wins you can fix today.
Use the Right Format
| Format | Best For | Compression |
|---|---|---|
| JPEG | Photos, complex images | Lossy |
| PNG | Logos, transparency needed | Lossless |
| WebP | Modern browsers, best of both | Lossy/Lossless |
| AVIF | Cutting-edge, smallest files | Lossy/Lossless |
For maximum compatibility, serve WebP with a JPEG/PNG fallback using the <picture> HTML element.
Compress Images via cPanel File Manager
cPanel doesn't have built-in image compression, but you can:
- Before upload: Use tools like Squoosh (browser-based) or ImageOptim (macOS app) to compress locally.
- Bulk optimize existing images: Use the WordPress plugin Imagify or ShortPixel — these process images already on your server and replace them with optimized versions.
- Automate via .htaccess (Apache): Enable Gzip or Brotli compression for non-image text-based assets:
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/css
AddOutputFilterByType DEFLATE application/javascript application/json
AddOutputFilterByType DEFLATE application/xml text/xml
</IfModule>
Add this block to your .htaccess file (found in your public_html directory). This compresses HTML, CSS, and JS before sending them to the browser — often reducing transfer size by 60–70%.
Lazy Load Images
Modern browsers support native lazy loading with a single HTML attribute:
<img src="hero-image.webp" alt="Hero" loading="lazy" />
For WordPress, this is enabled by default since WordPress 5.5. Make sure you haven't disabled it with a plugin.
5. Enable Browser Caching via .htaccess
Browser caching tells returning visitors to store static files (images, CSS, JS) locally so they don't re-download them on every visit.
Add the following to your .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"
</IfModule>
This is especially impactful for returning visitors. Tools like Google PageSpeed Insights and GTmetrix will specifically flag missing cache headers — adding these rules usually eliminates those warnings immediately.
Putting It All Together: A Quick Checklist
Here's a prioritized action list you can work through this week:
- Upgrade PHP to the latest stable version via cPanel MultiPHP Manager
- Enable OPcache and configure memory settings in
.user.ini - Install Query Monitor and fix any plugins running excessive DB queries
- Compress all images with Squoosh or ShortPixel before/after upload
- Convert images to WebP where browser support allows
- Add Gzip compression to
.htaccessfor text-based assets - Enable browser caching with
mod_expiresrules - Enable object caching (Redis or file-based) if available
Measure Before and After
Don't optimize blindly. Before making any changes, record your baseline metrics:
- TTFB (Time to First Byte): Should be under 200ms on good shared hosting
- Fully Loaded Time: Target under 3 seconds for most sites
- Total Page Size: Aim for under 1.5 MB
- Number of DB Queries: Under 50 for a typical WordPress page
Use WebPageTest.org for detailed waterfall analysis — it shows exactly which resources are slow and why, which is far more useful than a single score from a lighthouse tool.
Final Thoughts
Speeding up a cPanel hosting website doesn't require moving to a cloud server or spending money on expensive add-ons. The highest-impact changes — PHP version, OPcache, image optimization, and proper caching headers — are all available to you right now inside your cPanel dashboard or via a simple .htaccess edit.
If you've applied all these optimizations and you're still hitting a ceiling, that's usually a sign you've outgrown shared hosting and it's time to look at a VPS or a more resource-dedicated plan. Providers like GoCelerus offer cPanel-compatible shared and VPS plans that make this kind of migration straightforward when you're ready to scale.