1、 环境搭建手册〔PHP版〕 软件版本: Red Hat Enterprise Linux 5 Update 2 Mysql 版本: PHP依赖名称及版本: (3) libpng (4) jpegsrc (5) gd (6) libxml2 (7) libmcrypt (9) mcrypt 〔似乎非必需〕 安装步骤 一、 把所有依赖包,需要安装的软件放到home/username下 二、 先用rpm qa|grep –i 包名查找一下mysql, apache是不是已经装上了,例如 mysql qa|grep –i mysq
2、l mysql qa|grep –i d,如果mysql装上了,用rpm –e mysql 删除,如果 d也装上了的话…从新装系统把,清理起来太麻烦了。 三、 进入放包的目录,开始装吧: 32位机器: 1. 首先安装6.rpm,MySQL-server-community--0.rhel5. 依赖此包。 rpm -ivh perl-DBI-1.52-1.fc6.i386.rpm 2. 安装Mysql rpm -ivh MySQL-server-community--0.rhel5.i386.rpm rpm -ivh MySQL-client-communit
3、y--0.rhel5.i386.rpm rpm -ivh MySQL-devel-community-6 64位机器: 1 rpm –ivh 2 rpm –ivh MySQL-server-community- rpm –ivh MySQL-client-community- rpm –ivh MySQL-devel-community- 3. 安装Apache tar jxvf d- cd d- ./configure --pre
4、fix=/usr/local/apache2 --enable-so make make install 4. 安装libiconv cd libiconv ./configure --prefix=/usr/local/libiconv make make install 5. 安装freetype tar -zxvf freetype- cd freetype- ./configure --prefix=/usr/local/fre
5、etype2 make make install 6. 安装libpng cd libpng- ./configure --prefix=/usr/local/libpng make make install 7. 安装 jpegsrc mkdir /usr/local/jpeg6 mkdir /usr/local/jpeg6/bin mkdir /usr/local/jpeg6/lib mkdir /usr/local/jpeg6/inclu
6、de mkdir /usr/local/jpeg6/man mkdir /usr/local/jpeg6/man/man1 cd jpeg-6b/ 32位机器: ./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static make make install 64位机器: cp /usr/share/libtool/config.guess c cp /usr/share/libtool/config.sub
7、 ./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static make libdir=/usr/lib64 make libdir=/usr/lib64 install 使用64位函数库编译. 8. 安装gd tar vxf gd- cd gd- ./configure --prefix=/usr/local/gd --with-png-dir=/usr/local/lib --with-freetype-dir=/usr/local/freetype
8、2 --with-jpeg-dir=/usr/local/jpeg6 make && make install 或者:make make install 9. 安装libxml2 tar zxvf libxml2-2.6.32 cd libxml2-2.6.32 ./configure --prefix=/usr/local/libxml2 make make install 〔过程比拟缓慢,耐心等待〕 分支1 10. 安装〔libmcrypt〕
9、 tar vxf libmcrypt- cd libmcrypt- ./configure --prefix=/usr/local/libmcrypt make make install 11. 安装mhash tar xvf mhash-.tar.bz2 cd mhash-0.9.9/ ./configure --prefix=/usr/local/mhash make make install ln -s /usr/local/mhash/lib 11. 安装PHP tar xvf php-
10、 cd php- 32位机器: ./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-gd --with-jpeg-dir=/usr/local/jpeg6 --with-zlib --with-png-dir=/usr/local/lib --with-freetype-dir=/usr/local/freetype2 --with-iconv --with-gmp --with-curl --with-mcrypt-dir=/usr/local/
11、libmcrypt --with-pdo-mysql --with-json --with-gettext --with-libxml-dir=/usr/local/libxml2 --enable-sockets --enable-ftp --enable-soap --enable-zip --enable-mbstring --with-mhash-dir=/usr/local/mhash 64位机器: # mkdir /usr/local/lib/mysql # cd /usr/local/lib/mysql # ln –s /usr/include/mysql include
12、 # ln –s /usr/lib64/mysql lib ./configure --with-libdir=lib64 --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-gd --with-jpeg-dir=/usr/local/jpeg6 --with-zlib --with-png-dir=/usr/local/lib --with-freetype-dir=/usr/local/freetype2 --with-iconv --with-gmp --wit
13、h-curl --with-mcrypt-dir=/usr/local/libmcrypt --with-pdo-mysql-dir=/usr/local/lib/mysql --with-json --with-gettext --with-libxml-dir=/usr/local/libxml2 --enable-sockets --enable-ftp --enable-soap --enable-zip --enable-mbstring --with-mhash-dir=/usr/local/mhash --with-config-file-path=/usr/local/php5
14、/etc make make install 12. 修改配置文件 找到 DirectoryIndex index.html 改为 DirectoryIndex index.html index.html.var index.htm index.php 找到 AddType application/x-gzip .gz .tgz 加 AddType application/x- d-php .php (注意空格) AddType application/x- d-php-source .phps 13. 重启apache /usr/local/
15、apache2/bin/apachectl restart 14. 测试效果 如果没有修改路径的话,apache默认页面访问路径是cd /usr/local/apache2/htdocs/ 之后vim info.php,写个phpinfo看看效果吧。 //**********************注释掉*******************************// 分支2 〔这种做法可能存在问题〕 10. 安装〔libmcrypt〕 tar vxf libmcrypt- ./configure --prefix=/u
16、sr/local/libmcrypt make make install /sbin/ldconfig cd libltdl/ ./configure --enable-ltdl-install make make install 12. 安装mhash tar zxvf mhash-.tar.gz cd mhash-0.9.9/ ./configure --prefix=/usr/local/mhash make make install 13. 安装mcrypt tar zxvf mcrypt-2.6.7.tar.
17、gz cd mcrypt-2.6.7/ ./configure --prefix=/usr/local/mcrypt make make install //**************************注释掉******************************// 在64位机器上安装memcached 软件版本: Memcached . 安装需要支持的包及版本: Libevent -stable 安装步骤: 1. 安装libevent # tar zxvf libevent--sta # cd libevent--stabl
18、e # ./configure –prefix=/usr/local # make # make install 查看是否安装成功,进行确认: # ls –al /usr/loca/lib | grep libevent 在屏幕上出现如下信息,安装成功: lrwxrwxrwx 1 root root 21 Aug 7 09:35 libevent-1.4.so.2 -> libevent-1.4.so. -rwxr-xr-x 1 root root 384481 Aug 7 09:35 libevent-1.4.so. lrwxrwxrwx 1 roo
19、t root 26 Aug 7 09:35 libevent_core-1.4.so.2 -> libevent_core-1.4.so. -rwxr-xr-x 1 root root 135308 Aug 7 09:35 libevent_core-1.4.so. lrwxrwxrwx 1 root root 26 Aug 7 09:35 libevent_core.so -> libevent_core-1.4.so. lrwxrwxrwx 1 root root 27 Aug 7 09:35 libevent_extra-1.4.so.
20、2 -> libevent_extra-1.4.so. -rwxr-xr-x 1 root root 306301 Aug 7 09:35 libevent_extra-1.4.so. lrwxrwxrwx 1 root root 27 Aug 7 09:35 libevent_extra.so -> libevent_extra-1.4.so. lrwxrwxrwx 1 root root 21 Aug 7 09:35 libevent.so -> libevent-1.4.so. 2. 安装memcached # tar zxvf me
21、mcached- # cd memcached- # ./configure –with-libevent=/usr/local # make # make install 查看是否安装成功 # ls –al /usr/local/bin/mem* 出现如下信息: -rwxr-xr-x 1 root root 155077 Aug 7 09:41 /usr/local/bin/memcached -rwxr-xr-x 1 root root 162760 Aug 7 09:41 /usr/local/bin/memcached-debug 安装完成后,查看一下memc
22、ahce的help # /usr/local/bin/memcached –h 出现如下错误: memcached: error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or directory 注意: 下面是修复过程 # LD_DEBUG=lib memcached –v 查看memcached的libs的路径 屏幕显示如下信息: 7627: find library= libevent-1.4.so.2 [0];
23、 searching 7627: search cache=/etc/ld.so.cache 7627: search path=/lib64/tls/x86_64:/lib64/tls:/lib64/x86_64:/lib64:/usr/lib64/tls/x86_64:/usr/lib64/tls:/usr/lib64/x86_64: /usr/lib64 (system search path) 7627: trying file=/lib64/tls/x86_64/ lib
24、event-1.4.so.2 7627: trying file=/lib64/tls/ libevent-1.4.so.2 7627: trying file=/lib64/x86_64/ libevent-1.4.so.2 7627: trying file=/lib64/ libevent-1.4.so.2 7627: trying file=/usr/lib64/tls/x86_64/ libevent-1.4.so.2 7627: trying file=/usr/
25、lib64/tls/ libevent-1.4.so.2 7627: trying file=/usr/lib64/x86_64/ libevent-1.4.so.2 7627: trying file=/usr/lib64/ libevent-1.4.so.2 7627: memcached: error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such
26、 file or directory
我们要做的就是记录下最后一行信息, trying file=/usr/lib64/
然后我们利用这个来做个符号链接:
#
下面继续使用/usr/local/bin/memcached –h 做测试,成功显示:
memcached
-p
27、ket path to listen on (disables network support)
-a
28、hen run as root)
-m
29、 limit on how much memory you may lock. Trying to
allocate more than that would fail, so be sure you
set the limit correctly for the user you started
the daemon with (not for -u
30、S -l NUM_KB'). -v verbose (print errors/warnings while in event loop) -vv very verbose (also print client commands/reponses) -h print this help and exit -i print memcached and libevent license -b run a managed instanced (mnemonic: buckets)
31、P






