Public Beta — use code LAUNCH15 for 15% off any plan
Back to blog

How to Speed Up Your cPanel Hosting Website Effectively

By Yoga · 28 Jul 2026 · 7 min read

How to Speed Up Your cPanel Hosting Website Effectively

Why cPanel Hosting Speed Matters More Than You Think

A one-second delay in page load time can reduce conversions by up to 7%. If your website runs on cPanel shared hosting, you might assume performance is entirely out of your hands — but that assumption is wrong. cPanel exposes a surprisingly powerful set of tools that let you squeeze significantly better performance out of your hosting plan without touching a single server config file directly.

This guide walks you through practical, step-by-step optimizations you can implement today: upgrading your PHP version, enabling OPcache, tuning MySQL caching, and compressing images at the server level. No vague advice, no hand-waving — just actionable steps.


1. Upgrade to a Modern PHP Version

This is the single highest-impact change most cPanel users can make. PHP 8.x is dramatically faster than PHP 7.2 or 7.4, which many websites still run on by accident.

How to Change PHP Version in cPanel

  1. Log in to your cPanel dashboard.
  2. Navigate to Software → Select PHP Version (or MultiPHP Manager depending on your host's setup).
  3. Choose the latest stable PHP version your application supports (PHP 8.2 or 8.3 as of 2024).
  4. Click Set as current.

Before switching: Check your CMS or framework's compatibility. WordPress 6.x supports PHP 8.2+ fully. If you use older plugins, test on a staging environment first.

Why It Helps

PHP 8.x introduced the JIT (Just-In-Time) compiler and significant internal optimizations. Benchmarks consistently show PHP 8.2 executing the same WordPress page 2–3× faster than PHP 7.2 under identical conditions. This single change can shave hundreds of milliseconds off your Time to First Byte (TTFB).


2. Enable OPcache for PHP

Every time PHP processes a script, it parses and compiles the source code into bytecode. Without caching, this happens on every single request — a massive waste of CPU cycles.

OPcache stores the compiled bytecode in memory so PHP skips re-compilation on subsequent requests.

Enabling OPcache via cPanel

  1. In cPanel, go to Software → Select PHP Version.
  2. Click the Extensions tab.
  3. Find opcache in the list and tick the checkbox to enable it.
  4. Save changes.

Tuning OPcache with a .user.ini File

You can fine-tune OPcache behaviour without root access by adding a .user.ini file to your document root:

; .user.ini — place in your public_html or document root
opcache.enable=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1
Directive Recommended Value Purpose
memory_consumption 128 (MB) RAM allocated to bytecode cache
max_accelerated_files 4000–10000 Max files cached simultaneously
revalidate_freq 60 (seconds) How often PHP checks for file changes
interned_strings_buffer 8–16 (MB) Cache for repeated string values

After saving the .user.ini, verify OPcache is active by temporarily creating a phpinfo.php file and searching for the OPcache section — then delete the file immediately after checking.

<?php phpinfo(); ?>

3. Optimize MySQL Query Performance

Slow database queries are the silent killer of dynamic websites. On cPanel hosting you typically use MySQL via phpMyAdmin or your application's database credentials, but there are several things you can do at the application layer.

Add Database-Level Indexes

If you manage a custom application, make sure your most-queried columns are indexed. Open phpMyAdmin in cPanel, select your database, and check the Structure tab of your slowest tables.

For a WordPress site with WooCommerce, the wp_postmeta and wp_options tables are frequent culprits. Run this query to spot large unindexed tables:

SELECT table_name, table_rows, data_length, index_length
FROM information_schema.tables
WHERE table_schema = 'your_database_name'
ORDER BY data_length DESC;

Enable WordPress Object Cache with a File-Based Driver

If you're running WordPress, install a persistent object cache plugin that uses the filesystem (since most shared hosting plans don't offer Redis or Memcached). Plugins like W3 Total Cache or WP Super Cache can cache full page output to flat HTML files, bypassing PHP and MySQL entirely for repeat visitors.

For W3 Total Cache, the most impactful settings are:

  • Page Cache: Disk Enhanced mode
  • Database Cache: Enable with a 3600-second lifetime
  • Object Cache: Enable with filesystem backend

Keep Your Database Clean

Bloated databases slow down queries. In phpMyAdmin, run periodic optimizations:

-- Clean up WordPress post revisions older than 30 days
DELETE FROM wp_posts
WHERE post_type = 'revision'
AND post_date < NOW() - INTERVAL 30 DAY;

-- Optimize all tables in one shot
OPTIMIZE TABLE wp_posts, wp_postmeta, wp_options, wp_comments;

Alternatively, plugins like WP-Optimize automate this cleanup on a schedule.


4. Compress and Optimize Images at the Server Level

Images typically account for 60–80% of a page's total weight. The fastest image is one that's optimized before it's ever uploaded.

Enable Gzip / Brotli Compression via .htaccess

cPanel runs Apache by default, which means you can control compression through your .htaccess file. Add the following to the .htaccess in your public_html directory:

# Enable Gzip compression
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/html text/plain text/xml
  AddOutputFilterByType DEFLATE text/css application/javascript
  AddOutputFilterByType DEFLATE application/json application/xml
  AddOutputFilterByType DEFLATE image/svg+xml
</IfModule>

# Browser caching for static assets
<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 tells Apache to compress HTML, CSS, and JavaScript before sending them to the browser, and instructs browsers to cache static files locally — eliminating redundant downloads on repeat visits.

Convert Images to WebP Format

WebP images are typically 25–35% smaller than equivalent JPEGs at the same visual quality. For WordPress users, plugins like Imagify or ShortPixel convert uploads automatically and serve WebP to compatible browsers.

If you prefer a command-line approach via SSH (available on most cPanel plans under Terminal):

# Convert all JPEGs in a directory to WebP
for f in /home/yourusername/public_html/wp-content/uploads/*.jpg; do
  cwebp -q 80 "$f" -o "${f%.jpg}.webp"
done

Lazy-Load Images

Modern browsers support native lazy loading. For WordPress, add this filter to your theme's functions.php:

add_filter('wp_lazy_loading_enabled', '__return_true');

This adds loading="lazy" to all images below the fold, delaying their download until the user scrolls near them.


5. Configure Browser Caching and Minify Assets

Beyond image compression, reducing the size of your HTML, CSS, and JavaScript files cuts transfer time on every page load.

Minify CSS and JS via cPanel or Plugin

For WordPress, caching plugins like LiteSpeed Cache (if your host uses LiteSpeed) or Autoptimize can minify and combine CSS/JS files automatically. In Autoptimize:

  • Enable Optimize JavaScript Code
  • Enable Optimize CSS Code
  • Enable Optimize HTML Code
  • Check Also aggregate inline JS carefully — some scripts break when aggregated

Measure Your Improvements

After applying each optimization, measure the impact so you know what's actually helping:

  • Google PageSpeed Insights — free, highlights Core Web Vitals
  • GTmetrix — waterfall view shows which assets are slowest
  • WebPageTest — advanced testing from multiple global locations

Focus on improving Largest Contentful Paint (LCP) and Time to First Byte (TTFB) — these are the metrics Google weights most heavily in ranking signals.


Putting It All Together

Here's a quick priority checklist to work through:

  1. ✅ Upgrade PHP to 8.2+ in cPanel's MultiPHP Manager
  2. ✅ Enable and tune OPcache via the PHP extensions panel and .user.ini
  3. ✅ Enable full-page caching with disk-based output caching
  4. ✅ Clean and optimize your MySQL database tables regularly
  5. ✅ Add Gzip compression and browser cache headers via .htaccess
  6. ✅ Convert images to WebP and enable native lazy loading
  7. ✅ Minify HTML, CSS, and JavaScript assets

Each step compounds the previous one. A site that goes from PHP 7.2 with no caching to PHP 8.2 with OPcache, page caching, and compressed assets routinely sees TTFB drop from 800ms+ to under 200ms — a transformation that's entirely achievable on shared hosting.

If you're looking for a cPanel hosting environment already tuned for performance at the infrastructure level, GoCelerus offers shared and WordPress hosting plans built on modern server stacks — a solid foundation to layer these optimizations on top of.


Last reviewed: 2024. Configuration examples based on cPanel/WHM with Apache and PHP-FPM.

Welcome to GoCelerus

Save 15% on any plan

Launch promo — 15% off any plan

Your coupon code

LAUNCH15
Browse plans