Apache + PHP + PEAR 安装配置 + Memcache 简单学习心得

Memcache是什么
Memcache是danga.com的一个项目,最早是为 LiveJournal 服务的,目前全世界不少人使用这个缓存项目来构建自己大负载的网站,来分

担数据库的压力。
它可以应对任意多个连接,使用非阻塞的网络IO。由于它的工作机制是在内存中开辟一块空间,然后建立一个HashTable,Me

mcached自管理这些HashTable。
Memcache官方网站:http://memcached.org/,更多详细的信息可以来这里了解 

 

为什么会有Memcache和memcached两种名称?
其实Memcache是这个项目的名称,而memcached是它服务器端的主程序文件名,知道意思了吧~~~~。

 一个是项目名称,一个是主程序文件名,在网上看到了很多人不明白,于是混用了。

 

官方原文:

What is Memcached?

Free & open source, high-performance, distributed memory object caching system, generic in nature, but intend

ed for use in speeding up dynamic web applications by alleviating database load.

Memcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) from results of database

 calls, API calls, or page rendering.

Memcached is simple yet powerful. Its simple design promotes quick deployment, ease of development, and solves man

y problems facing large data caches. Its API is available for most popular languages.

 

Memcache的安装
分为两个过程:memcache服务器端的安装和memcached客户端的安装。
所谓服务器端的安装就是在服务器(一般都是linux系统)上安装Memcache实现数据的存储

下载地址:http://pecl.php.net/package/memcache
所谓客户端的安装就是指php(或者其他程序,Memcache还有其他不错的api接口提供)去使用服务器端的Memcache提供的函数,需要

php添加扩展。

 下载地址http://code.google.com/p/memcached/downloads/list

 

 

首先要安装Apache,其安装配置

下载地址: http://httpd.apache.org/download.cgi

下载一个for windows 的,如

Win32 Binary without crypto (no mod_ssl) (MSI Installer): httpd-2.2.15-win32-x86-no_ssl.msi [ PGP] [ MD5] [ SHA1] Win32 Binary including OpenSSL 0.9.8m (MSI Installer): httpd-2.2.15-win32-x86-openssl-0.9.8m-r2.msi [ PGP] [ MD5] [ SHA1]

注,看说明,如果安装了OpenSSL的就不用再装了,否则装下面的版本;

Apache是傻瓜式安装..(注意,如果您系统上装有IIS或其他Web服务器,请先停止其工作),

安装完毕后访问http://localhost会提示服务器正在工作:It works!

 

安装PHP  

下载地址:http://windows.php.net/download

本人下载的是:http://windows.php.net/downloads/releases/php-5.3.2-Win32-VC6-x86.zip

最好不要使用安装包,因为它不包含扩充部分,而您可能在你的项目中使用到这部分内容,按照下面部分配置PHP:

         a.解压压缩包到E:\php-5.3.2-Win32-VC6-x86\ 文件夹下(可选择其它盘)

         b.将php.ini-recommended 从 E:\php-5.3.2-Win32-VC6-x86\ 复制到Windows文件夹下,重命名为PHP.ini

         c.打开PHP.ini,将php_gd2.dll、php_mysql.dll、php_mysqli.dll、php_xsl.dll改为extension(简单地说,就是把它们前面的分号去掉)

         d.建议在开发环境下发送错误报告(此步骤可选),在PHP.ini中找到error_reporting一行,并修改为:error_reporting=e_all

         e.将E:\php-5.3.2-Win32-VC6-x86\ 下的php5ts.dll、libmysql.dll (如果php里面没有这个东东,就直接从MySQL的安装目录中,

          E:\mysql-5.1.39-win32\lib\debug直接copy )复制到Windows的system32文件夹下

         f.将E:\php-5.3.2-Win32-VC6-x86\ext\ 下的php_gd2.dll、php_mysql.dll、php_mysqli.dll、php_xsl.dll复制到Windows的system32文件夹下

         g.打开Apache配置文件httpd.conf,找到许多LoadModule条目的部分,添加以下内容:

                   LoadModule php5_module E:/php-5.3.2-Win32-VC6-x86/php5apache2_2.dll

         找到<IfModule mime_module>,在其相应位置下添加以下内容
                 AddType application/x-httpd-php .php
         h.找到DirectoryIndex条目,改成以下内容:

               DirectoryIndex index.html index.html.var index.php

         i.保存文件,然后重新启动Apache服务器
   j.在E:\Program Files\Apache Software Foundation\Apache2.2\htdocs目录 (此为网站默认路径,可以改配置,只需搜索此部分,

    把它改成实际的路径即可,

 

    注意,\要全部换成/)下,删除原有文件,新建名为index.php的文件,内容如下: 
                  <?php
                     phpinfo();
                  ?>
 
         k.最后,在浏览器输入网址http://localhost/index.php,你会看到相关PHP信息的页面

   l.搞掂,成功!

安装pear

pear是PHP的扩展和应用程序库,包含了很多有用的类,安装好php5.0后,pear实际上并没有被安装;

安装如下:

http://pear.php.net/manual/en/installation.getting.php获取http://pear.php.net/go-pear中的代码

并保存名为go-pear.php文件,放到任一个文件夹下,如E:\php-5.3.2-Win32-VC6-x86\go-pear.php(放在PHP的安装目录下最好)

然后打开命令控制台,定位到go-pear.php目录,

输入命令:php go-pear.php

开始安装,根据不同情况选择....其实选择默认的就可以了

重启Apache;

****************************************************************************************************

修改my.ini

 Modifying php.ini

To get PEAR working properly, you need to adjust PHP's include_path.

After you found php.ini, open it in an editor.

Search for the line include_path.

Now that you found it, you probably will see a semicolon ; at the beginning. This means the line is a comment.

Add a new line below it.

In this line, write:

include_path="."

Depending on your operating system, add a : (Unix/Linux/FreeBSD/Mac OS X) or a ; (Windows) after the dot.

Add PEAR's php_dir after it.

(The directory System.php is located in!)

The result should look like that:

; Unixinclude_path=".:/usr/local/php/pear/"

or

; Windowsinclude_path=".;E:\php-5.3.2-Win32-VC6-x86\PEAR\"

应该看懂上面的英文,(简单,不想翻译了)

***********本人感觉这里为可选设置,因为安装的时候有提示修改,可是后来我发现没修改,但是能够使用..冒汗中**********

详细介绍请看http://pear.php.net/manual/en/installation.getting.php

http://pear.php.net/manual/en/installation.checking.php#installation.checking.cli.modifyingphpini 

再+

http://pear.php.net/package/PEAR/download/All

配置完成,谨以此记录.....

转载于:https://www.cnblogs.com/puputu/archive/2010/04/01/1702403.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值