Soft2Hosting
WordPress Shared Hosting Optimization: Caching, wp-config Tweaks & Resource Limits
Optimizing WordPress on shared hosting ensures fast page load times and consistent reliability while remaining within shared server resource boundaries. In a shared hosting environment, multiple websites share the underlying server's processor cores and physical memory. By implementing effective page caching, tuning memory limits inside wp-config.php, and pruning database transients, website owners can dramatically accelerate load times and prevent resource throttling during traffic peaks.
Tuning Memory Limits in wp-config.php
By default, WordPress allocates 40 MB of PHP memory for single-site installations and 64 MB for multisite setups. However, modern commercial themes, page builders (such as Elementor), and e-commerce plugins (such as WooCommerce) require additional memory headroom to compile page templates and process image thumbnails.
According to official WordPress developer resources, you can increase the PHP memory limit by defining memory constants inside your wp-config.php file. Open wp-config.php via the cPanel File Manager and insert the following definitions directly above the line that reads /* That's all, stop editing! Happy publishing. */:
// Increase frontend PHP memory limit
define( 'WP_MEMORY_LIMIT', '256M' );
// Increase administration and backend memory limit
define( 'WP_MAX_MEMORY_LIMIT', '512M' );Setting WP_MEMORY_LIMIT to 256M ensures that complex frontend plugins execute without throwing fatal "Allowed memory size exhausted" errors. The WP_MAX_MEMORY_LIMIT constant specifically provides additional memory overhead for administrative tasks, such as bulk plugin updates, database migrations, and media uploads.
Enabling Page Caching: Bypassing Dynamic PHP Execution
On shared hosting, page caching is the single most effective performance enhancement you can implement. Without caching, every visitor request forces the web server to execute hundreds of PHP scripts and execute dozens of SQL database queries just to render a single page.
Page caching captures the fully compiled HTML output of your pages and saves it to disk or memory. Subsequent visitors are served static HTML files instantly, reducing server CPU utilization to near zero. Enable caching support in WordPress by adding the cache constant to wp-config.php:
define( 'WP_CACHE', true );This directive instructs WordPress to load the advanced caching drop-in (wp-content/advanced-cache.php) early during the bootstrap process. On Soft2Hosting's Business Pro and Enterprise Pro plans, the server environment is powered by LiteSpeed Web Server, allowing you to use the LiteSpeed Cache (LSCache) plugin. LSCache integrates directly with server-level page caching, delivering significantly faster response times than standard PHP-based caching plugins.
Object Caching with Redis on Enterprise Plans
While page caching accelerates requests for static visitors, dynamic requests (such as logged-in users, WooCommerce shopping cart updates, and administrative dashboards) cannot be served from static HTML caches. For these dynamic operations, object caching caches the results of complex SQL database queries in high-speed RAM.
On Soft2Hosting Enterprise Pro plans, LiteSpeed is paired with Redis object caching support. Once connected via the LiteSpeed Cache plugin settings, repetitive database queries—such as fetching site options, user metadata, and widget configurations—are retrieved from Redis memory rather than executing queries against MySQL disk tables, drastically reducing database query bottlenecks.
Database Maintenance: Cleaning Transients and Revisions
As a WordPress website matures, the MySQL database accumulates temporary records, expired transients, spam comments, and endless post revisions. Every post revision creates a complete duplicate entry in the wp_posts table, causing database tables to expand and slowing down SQL query execution.
Limit automated revision bloat by restricting the number of revisions WordPress saves. Add this directive to wp-config.php:
// Limit post revisions to 5 per post
define( 'WP_POST_REVISIONS', 5 );
// Increase autosave interval to 180 seconds (reduces server writes)
define( 'AUTOSAVE_INTERVAL', 180 );Periodically clean expired transient records and optimize database tables using phpMyAdmin or reputable optimization plugins. Keeping database tables lean ensures that product queries and post queries execute rapidly.
Image Optimization and Browser Caching
Uncompressed images are the leading cause of slow page loading. Optimize all media files before or during upload:
- Adopt Modern Image Formats: Convert legacy JPEG and PNG images to modern WebP format, which provides 25% to 35% smaller file sizes with equivalent visual quality.
- Configure Browser Caching Headers: Ensure your
.htaccessfile includesmod_expiresrules, instructing visitor browsers to store static CSS, JavaScript, and image files locally for up to one year, eliminating repeated downloads on return visits.
Soft2Hosting Plan Optimization Features
| Hosting Plan | Annual Price | Caching & Performance Features | Recommended Use Case |
|---|---|---|---|
| Starter Pro | Rs 2,499 / year | 10 GB NVMe, Standard cPanel, WP_CACHE support | Basic brochure websites and personal blogs. |
| Business Pro Hosting | Rs 4,999 / year | 50 GB NVMe, LiteSpeed Server + LSCache, Daily Backups | Active small business sites and commercial catalogs. |
| Enterprise Pro Hosting | Rs 7,999 / year | 100 GB NVMe, LiteSpeed + Redis Object Cache, Priority Support | WooCommerce stores and high-traffic content portals. |
Review full performance features and hosting options on Soft2Hosting Web Hosting.