资源描述
环境搭建手册〔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 mysql 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-community--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 --prefix=/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/freetype2
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/include
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
./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/freetype2 --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〕
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-
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/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
# 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 --with-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/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/apache2/bin/apachectl restart
14. 测试效果
如果没有修改路径的话,apache默认页面访问路径是cd /usr/local/apache2/htdocs/
之后vim info.php,写个phpinfo看看效果吧。
//**********************注释掉*******************************//
分支2 〔这种做法可能存在问题〕
10. 安装〔libmcrypt〕
tar vxf libmcrypt-
./configure --prefix=/usr/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.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--stable
# ./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 root 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.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 memcached-
# 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
安装完成后,查看一下memcahce的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]; 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/ libevent-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/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 file or directory
我们要做的就是记录下最后一行信息, trying file=/usr/lib64/
然后我们利用这个来做个符号链接:
#
下面继续使用/usr/local/bin/memcached –h 做测试,成功显示:
memcached
-p <num> TCP port number to listen on (default: 11211)
-U <num> UDP port number to listen on (default: 0, off)
-s <file> unix socket path to listen on (disables network support)
-a <mask> access mask for unix socket, in octal (default 0700)
-l <ip_addr> interface to listen on, default is INDRR_ANY
-d run as a daemon
-r maximize core file limit
-u <username> assume identity of <username> (only when run as root)
-m <num> max memory to use for items in megabytes, default is 64 MB
-M return error on memory exhausted (rather than removing items)
-c <num> max simultaneous connections, default is 1024
-k lock down all paged memory. Note that there is a
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 <username> user;
under sh this is done with 'ulimit -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)
-P <file> save PID in <file>, only used with -d option
-n <bytes> minimum space allocated for key+value+flags, default 48
到此,memcached安装成功。〔上面出现的问题是机器64位的原因,因为将so文件放到了lib64下面,而不是lib下面,使得memcached找不到so文件〕。
启动一个Memcached的效劳器端:
# /usr/local/bin/memcached -d -f
结束memcached进程:
# kill ‘’
展开阅读全文