首先…
我必须说,我不太了解服务器。 我是那种不经常使用命令行的PHP开发人员。 在docker我很不舒服。
不过,我正在学习。 我不习惯有没有托pipe托pipe专用服务器上我的网站。 但是现在我第一次拥有了,我需要自己安装Memcache。
一些服务器信息
我做了什么
我遵循这个指南: https : //mediatemple.net/community/products/dv/204644340/installing-pecl-extensions
但是,当然与memcache而不是uploadprogress 。
我已经检查,Memcache已经安装并正在运行。 和$memcache = new Memcache; 正在我的PHP代码工作。 但是$memcache->connect('localhost', 11211); 不pipe用。 我收到错误消息:
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
而且我试图将localhost更改为服务器的IP号码,但没有成功。
我已经search了很多,最后在关于安装Memcached之前的文章和论坛主题。 所以我遵循这些指南之一,并试图安装它。 但是得到错误消息No package memcached available. 所以无法安装。
下面是我之后做的一些命令:
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
所以…
我忘记了什么?
更新!
所以我最终成功了。 怎么样:
成功安装Memcached但不是Memcache:
[root@mydomain /]# yum install php-pecl-memcache Loaded plugins: fastestmirror, priorities Loading mirror speeds from cached hostfile * base: centos.mirror.nac.net * extras: mirror.atlanticmetro.net * updates: centos.mirror.nac.net base | 1.1 kB 00:00 extras | 2.1 kB 00:00 updates | 1.9 kB 00:00 Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package php-pecl-memcache.x86_64 0:2.2.3-1.el5_2 set to be updated --> Processing Dependency: php-api = 20041225 for package: php-pecl-memcache --> Finished Dependency Resolution php-pecl-memcache-2.2.3-1.el5_2.x86_64 from extras has depsolving problems --> Missing Dependency: php-api = 20041225 is needed by package php-pecl-memcache-2.2.3-1.el5_2.x86_64 (extras) Error: Missing Dependency: php-api = 20041225 is needed by package php-pecl-memcache-2.2.3-1.el5_2.x86_64 (extras) You could try using --skip-broken to work around the problem You could try running: package-cleanup --problems package-cleanup --dupes rpm -Va --nofiles --nodigest The program package-cleanup is found in the yum-utils package.
但是,似乎并不需要成功。 Memcache似乎现在工作!