How to Speed Up Your cPanel Hosting Website Fast
By Yoga · 30 Jun 2026 · 1 min read
If your website feels sluggish, the problem usually isn't your content — it's your server configuration. The good news is that cPanel gives you direct access to several performance levers that most hosting tutorials skip. This guide walks you through concrete, actionable steps to speed up your cPanel hosting website without needing a DevOps background.
1. Upgrade to the Latest Stable PHP Version
PHP is the engine running most dynamic websites — WordPress, Joomla, Laravel, you name it. Older PHP versions carry more overhead per request, which translates directly into slower page loads.
How to change your PHP version in cPanel
- Log in to cPanel and navigate to Software → MultiPHP Manager.
- Select your domain from the list.
- Choose the latest stable PHP release (currently PHP 8.2 or 8.3 depending on your host's available versions).
- Click Apply.
PHP 8.x can be up to 3× faster than PHP 5.6 on equivalent workloads thanks to improvements to the Zend Engine and the JIT compiler introduced in PHP 8.0.
Before switching: Test your site on a staging environment first. Some older plugins or custom code may not be compatible with newer PHP versions. Check for deprecation notices by enabling error reporting temporarily.
Verify your active PHP version
Create a file called info.php in your public root:
<?php
phpinfo();
Visit https://yourdomain.com/info.php, confirm the version, then delete the file immediately — leaving it public is a security risk.
2. Enable and Tune OPcache
Every time PHP executes a script, it compiles the source code into bytecode. Without caching, this compilation happens on every single request. OPcache stores the compiled bytecode in memory so PHP can skip the compilation step entirely.
Enable OPcache in cPanel
- Go to Software → MultiPHP INI Editor.
- Select your PHP version.
- Find
opcache.enableand set it to1. - Save changes.
Recommended OPcache settings
For a typical shared hosting site, add or confirm these values in your php.ini or via the MultiPHP INI Editor:
opcache.enable=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.revalidate_freq=60
opcache.validate_timestamps=1
| Setting | Value | Why It Matters |
|---|---|---|
memory_consumption |
128 MB | Holds compiled scripts in RAM |
max_accelerated_files |
10000 | Enough for large WordPress installs |
revalidate_freq |
60 seconds | Checks for file changes every minute |
validate_timestamps |
1 | Safe for development; set to 0 in production for max speed |
Once OPcache is active, benchmark with a tool like GTmetrix or WebPageTest — you should see a noticeable drop in Time to First Byte (TTFB).
3. Optimize MySQL for Faster Queries
Slow database queries are one of the most overlooked causes of a slow cPanel website. Here's how to address this at the application and server level.
Enable the MySQL Slow Query Log
If you have access to my.cnf (typically on VPS or dedicated plans), enable slow query logging:
[mysqld]
slow_query_log = 1
slow_query_log_file = /var/log/mysql/slow.log
long_query_time = 1
This logs every query that takes longer than 1 second. Review this file weekly and optimize the offenders with EXPLAIN statements.
Use a Query Cache (MySQL 5.7) or Optimize for MySQL 8
MySQL 5.7 supports query_cache_type. If your host runs it:
query_cache_type = 1
query_cache_size = 64M
Note: MySQL 8.0 removed the query cache because it caused contention under load. On MySQL 8, focus on proper indexing and application-level caching instead (see the WordPress Object Cache section below).
Add Indexes to Frequently Queried Columns
For custom applications, use:
EXPLAIN SELECT * FROM orders WHERE user_id = 42;
If you see type: ALL (a full table scan), add an index:
ALTER TABLE orders ADD INDEX idx_user_id (user_id);
For WordPress: Use a Persistent Object Cache
WordPress fires dozens of database queries per page. A persistent object cache like Redis or Memcached stores query results in memory.
- Ask your host if Redis or Memcached is available on your plan.
- Install the Redis Object Cache plugin (if using Redis).
- Add to
wp-config.php:
define('WP_CACHE', true);
This alone can cut database queries per page load by 60–80%.
4. Compress and Serve Images Efficiently
Images typically account for 60–70% of a page's total transfer size. Compressing them is the highest-ROI optimization on this list.
Step 1: Convert images to WebP
WebP images are 25–35% smaller than equivalent JPEGs and PNGs with no visible quality loss. In cPanel, if your host supports ImageMagick, you can convert images via SSH:
convert input.jpg -quality 85 output.webp
For WordPress, plugins like Imagify or ShortPixel handle bulk conversion and serve WebP automatically using <picture> tags or .htaccess rules.
Step 2: Enable Apache mod_deflate for image and text compression
Add the following to your .htaccess file (cPanel sites typically run Apache):
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/css
AddOutputFilterByType DEFLATE application/javascript application/json
AddOutputFilterByType DEFLATE image/svg+xml
</IfModule>
Note: JPEG and PNG files are already compressed binaries — DEFLATE won't help them. Focus DEFLATE on text-based assets.
Step 3: Set proper browser cache headers
Tell browsers to cache static assets locally so repeat visitors don't re-download them:
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/webp "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
</IfModule>
5. Enable Gzip Compression at the cPanel Level
cPanel's Optimize Website tool lets you enable Gzip compression with two clicks:
- In cPanel, go to Software → Optimize Website.
- Select Compress All Content (or choose specific MIME types).
- Click Update Settings.
Gzip typically reduces HTML, CSS, and JavaScript file sizes by 60–80%, dramatically reducing transfer time especially on mobile connections.
6. Use Caching at the Application Layer
Server-side page caching generates a static HTML snapshot of your page and serves it directly, bypassing PHP and MySQL entirely for repeat visitors.
For WordPress
- LiteSpeed Cache (if your host uses LiteSpeed Web Server) — the most effective all-in-one option.
- W3 Total Cache or WP Super Cache — solid alternatives on Apache hosts.
Configure your cache plugin to:
- Cache pages for logged-out users only (avoid caching logged-in sessions).
- Minify HTML, CSS, and JavaScript.
- Defer render-blocking JavaScript.
For non-WordPress PHP apps
Implement output buffering in your application:
ob_start('ob_gzhandler');
// ... your page content ...
ob_end_flush();
Or use a reverse proxy like Varnish if your VPS plan allows it.
Putting It All Together: Quick Reference Checklist
Here's a summary of every optimization covered and where to apply it:
| Optimization | Where to Apply | Difficulty |
|---|---|---|
| Upgrade PHP to 8.x | cPanel MultiPHP Manager | Easy |
| Enable OPcache | MultiPHP INI Editor | Easy |
| MySQL slow query log | my.cnf / VPS/Dedicated |
Medium |
| Redis object cache | Plugin + wp-config.php |
Medium |
| Convert images to WebP | Image plugin or SSH | Medium |
| Enable mod_deflate | .htaccess |
Easy |
| Set browser cache headers | .htaccess |
Easy |
| Enable Gzip in cPanel | Optimize Website tool | Easy |
| Page caching plugin | WordPress admin | Easy |
Start from the top — PHP version and OPcache are the lowest-effort, highest-impact changes. Then work your way through MySQL and image optimizations as time allows.
Final Thoughts
Speeding up a cPanel hosting website isn't about any single silver bullet. It's the accumulation of small, well-targeted changes across your PHP runtime, database, assets, and caching layers that produces a meaningfully faster site.
If you're on a shared hosting plan and hitting the limits of what configuration changes can do, it may be time to consider a VPS or an optimized hosting environment. Providers like GoCelerus offer cPanel-based plans where you can apply all of the above settings directly without needing to contact support for every change.
Measure your baseline with WebPageTest before you start, apply changes one at a time, and re-measure after each step. That way you'll know exactly which optimizations earned their keep.