How To Speed Up Your Osclass Classifieds Website
If you are using shared hosting of any kind, there are a couple of things you can do in less than 5 minutes, without any cost, that will make your Osclass faster and probably safer.
- Enable PHP 7.4.x from your Control Panel. It is surprising to see in 2022 that a lot of Osclass websites still use old PHP versions. Go to your Cpanel (Control Panel) and make PHP 7.4.x as DEFAULT and SAVE. That will make your Osclass faster and more secure. You will also have much better memory management. Just make sure you also enable the modules you need to use with 7.4.x.
- After you have switched to PHP 7.4.x (or 8.0.x if you use OsclassPoint releases) you can enable Opcache module from your Control Panel (Select PHP Version). With Opcache enabled my hosting plan never passes 35% cpu use. Also Opcache significantly expands the amount of data/requests I can handle per second without the server even breaking a sweat.
If you are not using Shared Hosting, you can still do both of the above, if you know your way around your server or your hosting plan. If you don’t know how to do it, it will be beyond the scope of this post to fully explain and you better open a ticket with your support for help.
Note 1: OPcache improves PHP performance by storing precompiled script bytecode in shared memory, thereby removing the need for PHP to load and parse scripts on each request. This extension is bundled with all PHP versions .By default it uses 64 mb for caching, so make sure your hosting provider allows 256 mb for php. If you have only 128 mb then do not enable Opcache or upgrade to a better hoster or hosting plan.
Note 2: Osclass 3.9/4/5 from Mindstellar are compatible with PHP 7.4.x with older plugins and themes. OsclassPoint releases are compatible with PHP 8.0.x, but you may encounter issues with older plugins and themes if used.
If you are a bit on the technical side, you can use Object Caching from your hosting plan, Memcache or APC/APCu. Before enabling cache make sure you have installed and enabled the cache extension for php.
APC / APCu
You need to edit your config.php file and the following line
define('OSC_CACHE', 'apc');
MEMCACHE
You need to know ip and port of the machine/s where memcached service is installed and then add the following lines to the file config.php
define('OSC_CACHE', 'memcache');
$_cache_config[] = array(
'default_host' => '127.0.0.1',
'default_port' => 11211,
'default_weight' => 1
);
Both options in Osclass (3/4/5/8) use old code that hasn’t been updated for years. Memcache is not used much anymore. MemcacheD is widely used instead but until today there is no official support.