[Ubuntu] How to install memcache in Ubuntu 10.10 with xampp

[Ubuntu] How to install memcache in Ubuntu 10.10 with xamppWhatineedtodownload:zlib-1.2.5.tar.gzhttp://zlib.net/zlib-1.2.5.tar.gzlibxml2-2.7.2.tar.gzftp://xmlsoft.org/libxml2/libxml2-2.7.2.tar.gzphp-5.3.4.tar.bz2http://ar.php.net/distributions/php-5.3.4.t…

大家好,又见面了,我是你们的朋友全栈君。

What i need to download:
zlib-1.2.5.tar.gz
http://zlib.net/zlib-1.2.5.tar.gz
libxml2-2.7.2.tar.gz
ftp://xmlsoft.org/libxml2/libxml2-2.7.2.tar.gz
php-5.3.4.tar.bz2
http://ar.php.net/distributions/php-5.3.4.tar.bz2
memcache-2.2.6.tgz
http://pecl.php.net/get/memcache-2.2.6.tgz
libevent-2.0.10-stable.tar.gz
http://www.monkey.org/~provos/libevent-2.0.10-stable.tar.gz
memcached-1.4.5.tar.gz
http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz

All the files above are locate in /home/davidhhuan/Software 

 

1. Install the libevent-2.0.10-stable.tar.gz 

cd 
/
home
/
davidhhuan
/
Software
tar zxf libevent


2.0
.
10

stable.tar.gz
cd libevent


2.0
.
10

stable
.

/
configure
sudo make
sudo make instsall

 

2. Install memcached-1.4.5.tar.gz 

cd 
/
home
/
davidhhuan
/
Software
tar zxf memcached


1.4
.
5
.tar.gz
cd memcached


1.4
.
5

.

/
configure
sudo make
sudo make install

  

3. Install memcache-2.2.6.tgz 

cd 
/
home
/
davidhhuan
/
Software
tar zxf memcache


2.2
.
6
.tgz
cd memcache


2.2
.
6


/
opt
/
lampp
/
bin
/
phpize

Ok, here i got these error: 

[Ubuntu] How to install memcache in Ubuntu 10.10 with xampp
ExpandedBlockStart.gif
代码

grep: 
/
opt
/
lampp
/
include
/
php
/
main
/
php.h: No such file or directory
grep: 

/
opt
/
lampp
/
include
/
php
/
Zend
/
zend_modules.h: No such file or directory
grep: 

/
opt
/
lampp
/
include
/
php
/
Zend
/
zend_extensions.h: No such file or directory
Configuring 

for
:
PHP Api Version:
Zend Module Api No:
Zend Extension Api No:

That is because i am using xampp, and xampp does NOT provide these files which only exist in php directory! Thought I don’t want to install another php in my host, but i still have to compile it to get the files, please follow the step 4. 

 

4. Compile php5 

cd 
/
home
/
davidhhuan
/
Software
tar zxf php


5.3
.
4
.tar.bz2
cd php


5.3
.
4

.

/
configure

Too bad, when i try to compile the php5, that said i don’t have the libxml2! ok, see the step 5 

 

5. Install libxml2-2.7.2.tar.gz 

cd 
/
home
/
davidhhuan
/
Software
tar zxf libxml2


2.7
.
2
.tar.gz
cd libxml2


2.7
.
2

.

/
configure
sudo make
sudo make install

 

6. Install php-5.3.4 again 

cd 
/
home
/
davidhhuan
/
php

5.3
.
4

.

/
configure
sudo make
sudo make install

  

7. Move the php files to xampp 

After step 6, the included php files are located in /usr/local/include, follow it 

sudo cp 

rf 
/
usr
/
local
/
include
/
php 
/
opt
/
lampp
/
include
/
php

 

8. Install memcache-2.2.6 again

cd 
/
home
/
davidhhuan
/
Software
/
memcache

2.2
.
6


/
opt
/
lampp
/
bin
/
phpize

OMG, i still met some errors: 

[Ubuntu] How to install memcache in Ubuntu 10.10 with xampp
ExpandedBlockStart.gif
代码

PHP Api Version:         
20041225

Zend Module Api No:      

20060613

Zend Extension Api No:   

220060519

Cannot find autoconf. Please check your autoconf installation and the 

$PHP_AUTOCONF
 environment variable is set correctly and then rerun this script.

so, i have to install autoconf, see step 9 

 

9. Install autoconf 

[Ubuntu] How to install memcache in Ubuntu 10.10 with xampp
ExpandedBlockStart.gif
代码

cd 
/
usr
/
src
sudo wget http:

//
ftp.gnu.org
/
gnu
/
m4
/
m4

1.4
.
9
.tar.gz
sudo tar 


zvxf m4

1.4
.
9
.tar.gz
cd m4


1.4
.
9
/

.

/
configure 
sudo make
sudo make install
cd ..

/

sudo wget http:

//
ftp.gnu.org
/
gnu
/
autoconf
/
autoconf

2.62
.tar.gz
sudo tar 


zvxf autoconf

2.62
.tar.gz
cd autoconf


2.62
/

.

/
configure
sudo make
sudo make install

 

10. Install memcache-2.2.6 again again! 

cd 
/
home
/
davidhhuan
/
Software
/
memcache

2.2
.
6


/
opt
/
lampp
/
bin
/
phpize
.

/
configure

-_-! I met errors: 

[Ubuntu] How to install memcache in Ubuntu 10.10 with xampp
ExpandedBlockStart.gif
代码

checking 
for
 the location of ZLIB… no
checking 

for
 the location of zlib… configure: error: memcache support requires ZLIB. Use 

with

zlib

dir
=
<DIR
>
 to specify prefix where ZLIB include and library are located
No problem, just install zlib

 

Go, go, go, step 11 can help you! :) 

 

11. Install zlib-1.2.5.tar.gz 

cd 
/
home
/
davidhhuan
/
Software
tar zxf zlib


1.2
.
5
.tar.gz
cd zlib


1.2
.
5

.

/
configure
sudo make
sudo make install

 

12. Install memcache-2.2.6 again again again! 

cd 
/
home
/
davidhhuan
/
Software
/
memcache

2.2
.
6

.

/
configure
sudo make
sudo make install

Thank goodness! At last i can compile outthe memcache.so, that is the message: 

Installing shared extensions:     
/
usr
/
local
/
lib
/
php
/
extensions
/
no

debug

non

zts

20090626
/

  

13. Copy the memcache.so to xampp 

sudo cp 
/
usr
/
local
/
lib
/
php
/
extensions
/
no

debug

non

zts

20090626
/
memcache.so 
/
opt
/
lampp
/
lib
/
php
/
extensions
/
no

debug

non

zts

20090626
/
memcache.so

 

14. Configure the php.ini 

extension
=
memcache.so

 

15. Configure the service of memcache

a. start the memcache server.

/
usr
/
bin
/
memcached 




100
 

u davidhhuan 


127.0
.
0.1
 


11211
 


256
 


/
tmp
/
memcached.pid
 

  -d: set to daemon 

  -m: max running memory, units:MB

  -u: the user of memcached

  -l: the server IP

  -p: the port

  -c: The maximum number of simultaneous connections running, default is 1024

  -P: the file to save the memcache

b. stop the server.

kill ‘cat 
/
tmp
/
memcached.pid’

 

You can also start multi thread to run the server, the port must be different. 

c. Restart the apache.

sudo 
/
opt
/
lampp
/
lampp restart

 

 

Example:

<?
php

$mem
 
=
 
new
 Memcache;

$mem
->
connect(

127.0.0.1

,
 
11211
);

$mem
->
set(

key

,
 

This is a test!

,
 
0
,
 
60
);

$val
 
=
 
$mem
->
get(

key

);

echo
 
$val
;

?>

 

 

 

All are done!

Hope this article will help you to install the memcache! 

 

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/139402.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • .npy文件_文件后缀名是npy怎么打开

    .npy文件_文件后缀名是npy怎么打开深度学习–迁移学习在使用训练好的模型时,其中有一种保存的模型文件格式叫.npy。打开方式·实现代码:importnumpyasnptest=np.load(‘./bvlc_alexnet.npy’,encoding=”latin1″)#加载文件doc=open(‘1.txt’,’a’)#打开一个存储文件,并依次写入print(test,file=doc)#…

    2022年10月22日
    0
  • 分布式锁的实现和应用场景_predis分布式锁的应用

    分布式锁的实现和应用场景_predis分布式锁的应用文章目录如何理解分布式锁分布式锁的常用实现基于关系型数据库存在单点故障风险不可重入无法实现阻塞应用Redis缓存基于ZooKeeper实现电商网站都会遇到秒杀、特价之类的活动,大促活动有一个共同特点就是访问量激增,在高并发下会出现成千上万人抢购一个商品的场景。虽然在系统设计时会通过限流、异步、排队等方式优化,但整体的并发还是平时的数倍以上,参加活动的商品一般都是限量库存,如何防止库存超卖,避免并发问题呢?分布式锁就是一个解决方案。如何理解分布式锁我们都知道,在业务开发中,为了保证在多线程下处理

    2022年9月7日
    0
  • 10月22日Ajax培训日记

    10月22日Ajax培训日记今天还是由梁言兵老师讲解Ajax,根据昨天学员的反馈,觉得AjaxTable这个项目太大了,学习起来有点费劲,希望梁老师讲一个较小的综合案例。所以,梁老师先讲解XTree这个客户端JavaScript组件,然后结合XTree,buffalo,spring,hibernate这些框架开发一个Ajax的demo。小收获:varobj={a:’xxx’b:function(){}}定义…

    2022年9月12日
    0
  • java的System.getProperty()方法能够获取的值

    java的System.getProperty()方法能够获取的值

    2021年12月2日
    41
  • 高斯滤波原理及应用_数字图像处理高斯滤波器

    高斯滤波原理及应用_数字图像处理高斯滤波器1一维高斯分布 1.1一维高斯分布的定义 若连续型随机变量X的概率密度为:其中,为常数,则称X服从参数为,的正态分布或高斯分布,记为 1.2一维高斯分布的曲线 横轴表示可能的取值x,竖轴表示概率分布密度F(x),那么不难理解这样一个曲线与x轴围…

    2022年10月22日
    0
  • 在非Activity中使用startActivityForResult

    在非Activity中使用startActivityForResult在开发过程中有时会有需要在非activity中,跳转到另一个activity中,再携带某些值回到先前的页面,我们在很多地方可以拿到context,但这个时候想使用startActivityForResult时却发现无法调用,因为这个方法是Activity下的,而非Context下,这个时候只需要强转一下即可,将获取到的context转成activity就可以使用这个方法了,在我的…

    2022年7月27日
    3

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号