How to Speed Up Your cPanel Hosting Website Fast
By Yoga · 14 Jul 2026 · 5 min read
If your website feels sluggish, the good news is that many performance wins live right inside your cPanel dashboard — no server admin degree required. This guide walks you through concrete, actionable steps to speed up your cPanel hosting website, with enough technical context to understand why each step matters.
Why Website Speed Matters More Than You Think
Google uses Core Web Vitals as a ranking signal, and visitors are notoriously impatient — studies consistently show that a one-second delay in page load can drop conversions by double-digit percentages. Before throwing money at a bigger server, squeeze every bit of performance out of your existing cPanel setup.
Let's start with the biggest levers first.
1. Upgrade to the Latest PHP Version
This single change can make your site noticeably faster with zero code changes.
PHP 8.x is substantially faster than PHP 7.x, and significantly faster than PHP 5.x (which is end-of-life and a security risk). Each major PHP release brings JIT compilation improvements, reduced memory overhead, and faster opcode execution.
How to Change PHP Version in cPanel
- Log into cPanel and navigate to Software → Select PHP Version.
- Choose the highest PHP version your application supports (check your CMS or plugin docs).
- Click Set as current.
- Test your site thoroughly — a plugin or theme may use deprecated functions.
Tip: If you run WordPress, check the WordPress PHP compatibility page before upgrading.
Quick Compatibility Check
Before switching, you can run a PHP compatibility scanner on your codebase:
# Install PHP compatibility checker via Composer
composer require --dev phpcompatibility/php-compatibility
# Run a scan against PHP 8.2
./vendor/bin/phpcs --standard=PHPCompatibility --runtime-set testVersion 8.2 /path/to/your/app
2. Enable OPcache for PHP
Every time PHP runs a script, it compiles the source code into bytecode. Without caching, this happens on every single request. OPcache stores pre-compiled bytecode in shared memory, eliminating that compilation overhead entirely.
Enabling OPcache in cPanel
- Go to Software → Select PHP Version.
- Click Switch to PHP Options (a tab or link near the top).
- Find
opcache.enableand set it to On. - Also enable
opcache.enable_clifor CLI scripts.
Recommended OPcache Settings
You can fine-tune OPcache via a custom php.ini or .htaccess in your public directory:
; Place in a custom php.ini or via cPanel PHP Options
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
| Setting | Recommended Value | Why |
|---|---|---|
memory_consumption |
128 MB | Stores more scripts in memory |
max_accelerated_files |
10000 | Covers large frameworks like Laravel |
revalidate_freq |
60 seconds | Balances freshness vs. performance |
fast_shutdown |
1 | Faster memory release at request end |
After enabling, verify OPcache is active by creating a temporary phpinfo() page and searching for the OPcache section.
3. Optimize MySQL / MariaDB Query Performance
Database queries are frequently the bottleneck in slow WordPress or CMS-driven sites. cPanel gives you access to phpMyAdmin and sometimes a MySQL configuration panel — use them.
Identify Slow Queries First
Before optimizing blindly, find out which queries are slow:
-- Enable the slow query log temporarily
SET GLOBAL slow_query_log = 'ON';
SET GLOBAL long_query_time = 1; -- log queries slower than 1 second
SET GLOBAL slow_query_log_file = '/tmp/mysql-slow.log';
Run this in phpMyAdmin's SQL tab. After a few minutes of traffic, check the log via File Manager or SSH.
Add Indexes to Frequently Queried Columns
If your slow query log shows repeated full-table scans, adding an index is often a 10x–100x fix:
-- Example: indexing a posts table by status and date
ALTER TABLE wp_posts ADD INDEX idx_status_date (post_status, post_date);
Enable MySQL Query Cache (MariaDB)
On shared cPanel hosting you usually can't edit my.cnf directly, but you can request your host to enable the query cache, or check if it's already on:
SHOW VARIABLES LIKE 'query_cache%';
If query_cache_type is OFF, ask your hosting support to enable it. On dedicated or VPS plans, add this to my.cnf:
[mysqld]
query_cache_type = 1
query_cache_size = 64M
query_cache_limit = 2M
Use a WordPress Object Cache Plugin
For WordPress sites, install a persistent object cache plugin (such as W3 Total Cache with database caching enabled, or WP Redis if your host supports Redis). This caches database query results in memory, serving repeat requests without hitting MySQL at all.
4. Compress and Serve Images Properly
Images typically account for 50–80% of a page's total byte weight. Compressing them before upload — and serving them at the correct dimensions — is one of the highest-ROI optimizations available.
Bulk Compress Images via cPanel File Manager + ImageMagick
If you have SSH access (available on most cPanel plans), you can batch-optimize existing images:
# Compress all JPEGs in your uploads folder to 85% quality
find /home/yourusername/public_html/wp-content/uploads -name '*.jpg' \
-exec convert {} -quality 85 -strip {} \;
# Convert PNGs to WebP (modern browsers support WebP natively)
find /home/yourusername/public_html/wp-content/uploads -name '*.png' \
-exec cwebp -q 80 {} -o {}.webp \;
Enable Gzip/Brotli Compression via .htaccess
Text-based assets (HTML, CSS, JS) should always be served compressed. Add this to your .htaccess:
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain text/html text/css
AddOutputFilterByType DEFLATE application/javascript application/json
AddOutputFilterByType DEFLATE image/svg+xml application/xml
</IfModule>
# Browser caching for static assets
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpeg "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>
Serve WebP Conditionally
Modern browsers support WebP, but older ones don't. Serve WebP to supported browsers while falling back to JPEG/PNG:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{REQUEST_FILENAME}.webp -f
RewriteRule ^(.+)\.(jpe?g|png)$ $1.$2.webp [T=image/webp,E=accept:1]
</IfModule>
5. Enable Caching at the Application Layer
Even with a fast PHP version and optimized database, generating every page dynamically on every request is wasteful. Full-page caching serves pre-built HTML to visitors, reducing PHP and MySQL load dramatically.
For WordPress: Caching Plugins
- LiteSpeed Cache — if your host runs LiteSpeed web server (many cPanel setups do), this plugin is deeply integrated and extremely effective.
- W3 Total Cache — works with Apache/Nginx, supports page cache, database cache, object cache, and browser cache from one dashboard.
- WP Super Cache — simpler option that generates static HTML files served directly by Apache, bypassing PHP entirely.
For Custom PHP Apps
Implement output buffering and cache the result to a file:
<?php
$cache_file = '/tmp/cache/' . md5($_SERVER['REQUEST_URI']) . '.html';
$cache_ttl = 3600; // 1 hour
if (file_exists($cache_file) && (time() - filemtime($cache_file)) < $cache_ttl) {
echo file_get_contents($cache_file);
exit;
}
ob_start();
// ... your normal page output ...
$content = ob_get_clean();
file_put_contents($cache_file, $content);
echo $content;
Putting It All Together: A Priority Checklist
Here's a quick action checklist in order of impact-per-effort:
- ✅ Upgrade PHP to 8.1+ in cPanel → Software → Select PHP Version
- ✅ Enable OPcache with optimized settings in PHP Options
- ✅ Compress images and convert to WebP using ImageMagick or a plugin
- ✅ Add .htaccess rules for Gzip compression and browser caching
- ✅ Install a caching plugin appropriate for your CMS
- ✅ Review slow query logs in phpMyAdmin and add missing indexes
- ✅ Enable MySQL query cache (request from host if on shared plans)
Final Thoughts
Speeding up a cPanel hosting website doesn't require migrating to a different server or spending more money right away. The optimizations above — PHP version upgrades, OPcache, database tuning, image compression, and application-layer caching — can collectively reduce your Time to First Byte (TTFB) and Largest Contentful Paint (LCP) scores significantly.
After implementing these changes, measure your results using Google PageSpeed Insights or WebPageTest to confirm the improvements and identify any remaining bottlenecks.
If you're looking for a cPanel hosting environment that supports modern PHP versions, OPcache, and LiteSpeed out of the box, GoCelerus offers shared and WordPress hosting plans built with these performance features enabled by default — giving you a solid foundation to build on.