Report this

What is the reason for this report?

how to install Separate memcache server on ubuntu and Use from other server ?

Posted on April 29, 2016
Om

By Om

I have one custom made php & mysql web application , hosted in separate server’s ,in Singapore region . one php server + one mysql db server , both working fine . because , app have read more than the write , So i want to add a one memcache server . memcached server successfully installed and cached the test data on localhost . But i want to use this on other remote web server so i have change in memcached.conf file -l 127.0.0.1 to memcached server private ip 10.x.x.x . On php server , try to connect memcached server but its always shows a HTTP ERROR 500 error page , page isn’t working error .

tried lots of googling this but not helping any thing ! Do i have to install any connector ON PHP app server to connect with memcached server on private ip .



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi!

You are on the correct path. Once you’ve configured memcached to listen on the private IP address, you need to configure PHP to connect to that IP address for memcached.

Open /etc/php5/fpm/php.ini in your favorite text editor and update the following settings:

session.save_handler = memcache
session.save_path = 'tcp://10.1.1.1:11211'

Finally, restart php5-fpm so that the changes take effect:

sudo service php5-fpm restart

If you still get a 500 error after doing that, check nginx’s error logs (which is where php5-fpm’s errors should go) and see if there are any details in there:

sudo tail -20 /var/log/nginx/error.log

hey @kamaln7 thanks for response , yes i have checked the php based web server’s error logs , that says 2016/04/29 05:01:28 [error] 4355#0: *494 FastCGI sent in stderr: "PHP message: PHP Fatal error: Class 'Memcached' not found in /var/www/test.php .

So when i install memcached on web server apt-get install php5-memcached , & added in php.ini extension = memcached.so , than php web server start connected to remotely memcached server , now everything works fine ,

So is this right way to connect other server ? do we have too install memcached in web server ?

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.