To lower CPU and memory use, run PHP 8.x with OPcache, keep WordPress updated, use one caching plugin, remove plugins you do not need and disable WP-Cron.
Every hosting plan has limits on CPU (processing power) and memory. When your website reaches these limits, pages load slowly and visitors see error 508 (Resource Limit Is Reached) until usage drops.
The tips below are for websites built on PHP and MySQL, such as WordPress and Moodle. The examples use WordPress. Image and media optimization is not covered here.
Before you begin
- Log in to the 2MHost client area at www.2mhost.com/login. You open cPanel from there.
- Have an administrator login for your WordPress dashboard (wp-admin).
Switch to PHP 8.x and turn on OPcache
At the time of writing, the standard PHP installation on all 2MHost servers is PHP 8.3 with OPcache turned on. See Upgrade PHP in all servers to PHP 8.3. The steps in this section are for you if you chose to run a different PHP version.
PHP 8.x runs code faster than PHP 7.x and uses fewer server resources. OPcache, a PHP feature that keeps compiled code in memory, cuts CPU use further because PHP does not recompile the same code on every visit.
- In the 2MHost client area, go to Hosting accounts and click the cPanel button of your hosting account.
- In cPanel, open Software › Select PHP Version.
- Select a PHP 8.x version, for example PHP 8.3, as the current version and apply it.
- Open the Extensions tab and make sure the
opcachecheck box is selected. - Open your website in a browser and test the main pages, contact forms and checkout.
For full instructions, see How to change the PHP version in cPanel.
Warning: An old theme or plugin that does not support PHP 8 can break your site. Update your theme and plugins and take a backup first. If the site shows errors after the switch, select the previous PHP version again.
Keep WordPress, themes and plugins updated
Each WordPress release brings performance and security fixes. An up-to-date site usually uses fewer resources and runs more reliably.
- Log in to your WordPress dashboard (wp-admin).
- Go to Dashboard › Updates.
- Update WordPress core if an update is available.
- In the plugins list, select all plugins and click Update Plugins.
- In the themes list, select all themes and click Update Themes.
On the same page, keep automatic updates turned on at least for maintenance and security releases of WordPress.
Use one caching plugin
Caching stores ready-made copies of your pages and other data, so PHP and MySQL do not have to run on every visit. This sharply reduces CPU and database load.
Use exactly one caching or "performance" plugin in WordPress. Two or more of them conflict, do the same work twice and often use more resources, not less.
- On LiteSpeed servers: use the free LiteSpeed Cache plugin (LSCache) and disable every other caching plugin. LSCache works with the server for page and browser caching, and it can also turn on Redis object caching. See How to enable LSCache on my website.
- On other servers: choose one well-known caching plugin and keep it. Do not turn on the same feature, such as CSS minification, in two plugins.
After you turn on caching:
- Visit your most important pages while logged out of WordPress, so the cache fills up (this is called warming the cache).
- Check the plugin's purge settings and make sure it does not clear the whole cache too often, for example every hour.
Remove WordPress plugins you do not need
Fewer plugins means a faster, lighter site. Every active plugin loads code on each request or website visit, and many run database queries or background tasks.
Audit your plugins
- Deactivate and delete plugins you do not use.
- Keep only one plugin for each job.
- Prefer well-maintained, lightweight plugins that get regular updates.
Plugins you do not need on 2MHost servers
- Security suites, such as Wordfence: Imunify360 protects 2MHost servers at the server level, with a firewall, a web application firewall (WAF) and malware scanning. Security plugins add little on top and can use a lot of CPU and disk activity. See Do I need to use Wordfence on my WordPress website?
- SSL or HTTPS helper plugins: 2MHost installs and renews SSL certificates automatically. You do not need a plugin that installs, renews or "monitors" SSL.
Delete a plugin
- In WordPress, go to Plugins › Installed Plugins.
- Under the plugin name, click Deactivate.
- Click Delete under the same plugin and confirm. The plugin disappears from the list.
Find slow plugins with PHP X-Ray
If you do not know which plugin slows your site, use PHP X-Ray in 2MHost cPanel. It shows which WordPress plugins and code take the most time. See How to find slow WordPress plugins with PHP X-Ray in cPanel.
Disable WP-Cron on busy WordPress sites
WP-Cron is the WordPress task scheduler. WordPress checks for scheduled tasks on page visits, so on a site with medium or high traffic it runs far more often than needed.
Disabling WP-Cron and running scheduled tasks from a cPanel cron job instead can reduce resource usage significantly. Follow the steps in How to disable WP-Cron (wp-cron.php) to boost performance.
Move to LiteSpeed Performance Hosting
The LiteSpeed web server handles many visitors at once more efficiently than Apache, thanks to its event-driven design and LSAPI for PHP. It usually lowers CPU and memory usage and speeds up responses, especially under load.
- Choose a Performance Hosting plan, or open a help ticket to ask for your account to move to a LiteSpeed server.
- Install and configure the LSCache plugin in WordPress. See Auto installation of LiteSpeed Cache plugin for WordPress.
More ways to reduce resource usage on shared hosting
Limit post revisions and clean the database
WordPress saves a copy of a post every time you save it. Over time, thousands of revisions, spam comments and expired temporary data make the database larger and queries slower.
To keep only the last 5 revisions of each post, open wp-config.php in cPanel File Manager and add this line above the line that starts with /* That's all, stop editing!:
define( 'WP_POST_REVISIONS', 5 );
Replace 5 with the number of revisions you want to keep. To delete old revisions, spam comments and expired data, use the database tools in LSCache or one database cleanup plugin.
Slow down the WordPress Heartbeat
The Heartbeat API makes open WordPress dashboard tabs contact the server every 15 to 60 seconds, and each request runs PHP. Close dashboard tabs you are not using. On LiteSpeed servers, use the heartbeat settings in LSCache to make it run less often.
Check your cron jobs
In cPanel, open Advanced › Cron Jobs and review the scheduled commands. A job that runs every minute uses resources all day, so run each job only as often as it needs.
Block traffic you do not need
Bots and visitors from countries you do not serve still use CPU. If your business serves only some countries, you can block others. See GeoLocation: allow or deny access to your website by country.
Delete unused sites and staging copies
Old WordPress installations, test sites and staging copies in your hosting account use resources when bots visit them. They are also a security risk when nobody updates them. Take a backup, then delete the ones you no longer need.
Check the results
Measure after each change, so you know what helps.
- Check your site's load times while logged out of WordPress, because logged-in visits skip most caching.
- Check the resource usage graphs in the 2MHost client area and in cPanel > resources usage.
- Watch the site under normal traffic for a day or two.
Keep the changes that measurably help and undo the rest.
Troubleshooting
The site shows errors after changing the PHP version
A theme or plugin likely does not support the new PHP version. In cPanel, open Software › Select PHP Version, select the previous version, then update or replace the plugin and try again.
The page layout breaks after turning on caching
CSS or JavaScript optimization (minify or combine) is the usual cause. Turn off those options in the caching plugin, purge the cache, then turn them back on one at a time to find the one that breaks the layout.
Frequently asked questions
Will a bigger hosting plan fix high resource usage?
Not always. A bigger plan gives more room, but a slow plugin or a missing cache keeps using too much. Apply the steps above first; if the site still reaches its limits, you can upgrade your hosting account from 2mhost clients area.
Do these tips work for Moodle and other PHP sites?
Yes, in part. PHP 8.x, OPcache, cron job frequency and blocking unwanted traffic help any PHP and MySQL site. The plugin and WP-Cron tips are for WordPress.
Do I need Redis object caching?
Not on every site. It helps most on busy, dynamic sites such as online stores and membership sites. See What is Redis object caching and how to use it for WordPress?