Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
memcached_unix_socket [2018/01/17 22:10] qtwrk [for Ubuntu 17.10, Ubuntu 16.04, Debian 8 and Debian 9] |
memcached_unix_socket [2018/01/17 22:45] qtwrk [for Ubuntu 14.04 and Debian 7] |
||
---|---|---|---|
Line 4: | Line 4: | ||
+ | |||
+ | =====Note===== | ||
Please use root privilege to the following instructions. | Please use root privilege to the following instructions. | ||
+ | |||
+ | If memcached failed to start , it is usually due to permission and user problem , please check the socket path is writable to designated user. | ||
=====for Centos7.X===== | =====for Centos7.X===== | ||
Line 11: | Line 15: | ||
2. Copy file service file <code>cp /usr/lib/systemd/system/memcached.service /etc/systemd/system/memcached.service</code> | 2. Copy file service file <code>cp /usr/lib/systemd/system/memcached.service /etc/systemd/system/memcached.service</code> | ||
- | 3. Add following content to /etc/systemd/system/memcached.service ,after [Service], please change username to php user | + | 3. Add following content to /etc/systemd/system/memcached.service ,after [Service], please change username to the same user that runs PHP |
<code>User=username | <code>User=username | ||
Group=username | Group=username | ||
Line 40: | Line 44: | ||
2. Edit /etc/sysconfig/memcached | 2. Edit /etc/sysconfig/memcached | ||
change <code>OPTIONS=""</code> to <code>OPTIONS="-s /path/to/memcached.sock -a 0770"</code> | change <code>OPTIONS=""</code> to <code>OPTIONS="-s /path/to/memcached.sock -a 0770"</code> | ||
- | change <code>USER=""</code> to <code>USER="username"</code> the same user runs php | + | change <code>USER=""</code> to <code>USER="username"</code>, the same user that runs PHP |
3. Start memcached <code>service memcached start</code> | 3. Start memcached <code>service memcached start</code> | ||
Line 54: | Line 58: | ||
<code>-s /path/to/memcached.sock | <code>-s /path/to/memcached.sock | ||
-a 0770</code> | -a 0770</code> | ||
- | and change <code>-u </code> to <code>-u username</code> | + | and change <code>-u memcache</code> to <code>-u username</code> |
- | a username that runs PHP. | + | the same user that runs PHP |
Line 71: | Line 75: | ||
2. Edit <code>/etc/memcached.conf</code>comment out host and port , add socket path and permission. | 2. Edit <code>/etc/memcached.conf</code>comment out host and port , add socket path and permission. | ||
- | <code>-s /tmp/memcached.sock | + | <code>-s /path/to/memcached.sock |
- | -a 755</code> | + | -a 0770</code> |
- | Add additional line on Ubuntu 14.04 | + | and change <code>-u memcache</code> to <code>-u username</code> |
- | <code>-u root</code> | + | the same user that runs PHP |
- | + | ||
- | {{ :litespeed_wiki:cache:lscwp:configuration:mem-socket-ubuntu1.png?direct |}} | + | |
3. Start memcached again <code>service memcached start</code> | 3. Start memcached again <code>service memcached start</code> | ||
4. Check if everything goes well. | 4. Check if everything goes well. | ||
- | <code>nc -U /tmp/memcached.sock</code> | + | <code>nc -U /path/to/memcached.sock</code> |
and then type <code>stats</code> | and then type <code>stats</code> | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | ======FAQ====== | ||
- | |||
- | If memcached failed to start , it usually due to permission and user problem , please check the socket path is writable to user designated. | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | sources: | ||
- | |||
- | https://www.orangecoat.com/how-to/run-memcached-as-a-socket-under-systemd-in-centos-or-rhel-7 | ||
- | |||
- | https://chirale.org/2015/09/04/installing-and-configure-memcache-on-centos-7/ | ||
- | |||
- | https://guides.wp-bullet.com/install-latest-memcached-object-cache-wordpress-php5-debian/ |