Before you can use Memcached, your KamHost hosting plan must have Memcached instances available. Here’s how to get started.
Step 1: Enable the PHP Memcached Extension
If you’re using PHP, you’ll need to enable the memcached extension:
- Log in to your hosting control panel.
- Navigate to Advanced → PHP Settings.
- Click Edit php.ini.
- Find theÂ
memcached option and set it to On. - Save your changes.
Note: If you don’t see the
memcachedoption, contact your hosting provider – it may not be available on your current plan.
Step 2: Create a Memcached Instance
Your hosting plan must have at least one Memcached instance available. Here’s how to create one:
- In your KamHost hosting control panel, go to Advanced → Memcached.
- Click the CREATE INSTANCE button.
- Configure the instance settings:
- Status: Set to Active
- Memory:Â Select the desired memory allocation
- Click the Add button to create the instance.
Note: Each instance comes with 16 MB of memory by default. You can select a higher amount if available on your plan.
Step 3: Connect Your Application to Memcached
Many applications require a host and port to connect to Memcached. On our system, Memcached uses a Unix socket instead of a TCP port.
Use the following settings:
| Setting | Value |
|---|---|
| Memcached Hostname (IP) | unix:///home/sys/memcached.sock |
| Memcached Port | 0 |
Example (PHP):
php
$memcached->addServer('unix:///home/sys/memcached.sock', 0);
Important: Check with your hosting provider to confirm whether your system uses a Unix socket or TCP/IP, as the format varies between hosting environments.
Frequently Asked Questions
Why does Memcached use a socket instead of a port?
Our system uses Unix sockets for Memcached because they offer better performance and security compared to TCP/IP connections. Sockets are faster because they don’t require network overhead.
How much memory does each Memcached instance provide?
Each instance provides 16 MB of memory. You can purchase multiple instances if you need more caching capacity.
What happens if I run out of Memcached memory?
When memory is full, Memcached automatically removes the oldest or least-used data (LRU eviction) to make room for new data. If you need more capacity, you can add additional instances.
Can I use Memcached with other programming languages?
Yes. While we used PHP examples in this guide, Memcached supports virtually every programming language, including Python, Java, Ruby, Node.js, and more.
Troubleshooting
| Issue | Solution |
|---|---|
| Memcached option not showing | The PHP extension isn’t enabled. Go back to Step 1 and enable memcached. |
| Application can’t connect | Confirm you’re using the correct socket path: unix:///home/sys/memcached.sock |
| Connection refused error | The Memcached service may not be running. Contact support for assistance. |
| No caching benefit | Your application must be configured to use Memcached. Check your application’s caching settings. |
Need Help?
 If you have questions about enabling Memcached on your hosting plan, our support team is here to help. Submit a ticket under Help Center → My Tickets in your hosting control panel, and we’ll get back to you promptly.
