First of all...
I must say, I don't know much about servers. I'm the kind of php developer that don't use command lines very often. I'm very uncomfortable in the Terminal.
However, I'm learning. I'm not used to have my websites on dedicated servers without managed hosting. But now I have it for the first time, and I need to install Memcache by my self.
Some Server Info
- Product: Dedicated Server (DV) on Media Temple
- Parallels® Plesk Panel 12 or cPanel® 11
- CentOS 5.7 (Final)
- Apache 2.2
- PHP 5.4
- YUM package management
What I've done
I have followed this guide: https://mediatemple.net/community/products/dv/204644340/installing-pecl-extensions
But of course with memcache
instead of uploadprogress
.
And I have checked, Memcache is installed and running. And $memcache = new Memcache;
is working in my php codes. But $memcache->connect('localhost', 11211);
is not working. I get error message:
Warning: Memcache::connect(): Can't connect to localhost:11211, Connection refused (111) in /var/www/vhosts/[mydomain]/httpdocs/index.php on line 10 Could not connect to memcache server
And I have tried to change localhost
to the server's IP number but without success.
I have googled a lot, and ended up in articles and forum threads about installing Memcached
before. So I followed one of those guides and tried to install it. But got error messages No package memcached available.
so it couldn't be installed.
Here are a sample of commands I did after that:
Nothing to do
[root@mydomain /]# php -i | grep memcache
PHP Warning: Module 'memcache' already loaded in Unknown on line 0
/etc/php.d/memcached.ini,
PHP Warning: Unknown: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Los_Angeles' for 'PDT/-7.0/DST' instead in Unknown on line 0
memcache
memcache support => enabled
memcache.allow_failover => 1 => 1
memcache.chunk_size => 8192 => 8192
memcache.default_port => 11211 => 11211
memcache.default_timeout_ms => 1000 => 1000
memcache.hash_function => crc32 => crc32
memcache.hash_strategy => standard => standard
memcache.max_failover_attempts => 20 => 20
Registered save handlers => files user memcache
OLDPWD => /memcached-1.4.9
_SERVER["OLDPWD"] => /memcached-1.4.9
[root@mydomain /]# ps aux | grep memcache
root 6434 0.0 0.0 9288 868 pts/0 S+ 02:37 0:00 grep memcache
[root@mydomain /]# getenforce
Disabled
So...
What did I forget to do?
netstat -alnp
should return a line containing0.0.0.0:11211
if it is.chkconfig memcached on
service memcached start
doesn't work.netstat -alnp
return a lot of lines and no one like that.chkconfig memcached on
retured a error message that the directory doesn't exist.Error when reading information about the service memcached: File or directory does not exist