如何在linux上安装memcached扩展(将memcached.so扩展名添加到php.ini)

时间:2016-01-25 08:40:51

标签: php linux amazon-ec2 memcached

我已将此行添加到php.ini文件中。

date_format %Y/%m/%d  
time-format %H:%M:%S  
log-format %h %^ %r %T %^ %^ %r %s %b  

当我运行php命令时,我收到了错误消息。

extension=memcached.so

我正在AWS EC2(Linux AMI)上部署php项目。 我已经在linux AMI上安装了memcached,并使用此命令成功运行memcached服务。

[ec2-user@ip-172-31-1-237 ~]$ php -v
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/5.6/modules/memcached.so' - /usr/lib64/php/5.6/modules/memcached.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP 5.6.17 (cli) (built: Jan 16 2016 00:21:00)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies

我已经检查了这样的memcached服务状态。

sudo service memcached start 

然后我尝试像这样安装memcached扩展。

[ec2-user@ip-172-31-1-237 ~]$ echo stats | nc -4 localhost 11211
STAT pid 15597
STAT uptime 5807
...
END

但是我收到如下错误消息:

wget http://pecl.php.net/get/memcached
tar -zxvf memcached
cd memcached-x.x.x
phpize

所以我试着像这样安装php-devel。

[ec2-user@ip-172-31-1-237 memcached-2.2.0]$ phpize
Can't find PHP headers in /usr/include/php/5.6/php
The php-devel package is required for use of this command.

谁能帮帮我? 问候。

0 个答案:

没有答案