日期:2014-05-16  浏览次数:20937 次

linux上apache+php+mysql+memcache的安装
搞了半天终于在服务器上搭好了三者,呼呼啊。

留下整个过程中的一些记录,以飨后人……



===================Apache===============
http://rpm.pbone.net/index.php3/stat/4/idpl/15773099/dir/centos_5/com/httpd-2.2.3-45.el5.centos.1.x86_64.rpm.html http://pkgs.org/centos-5-rhel-5/centos-rhel-updates-x86_64/httpd-2.2.3-45.el5.centos.1.x86_64.rpm.html download httpd-2.2.3-45.el5.centos.1.x86_64.rpm [root@localhost zhanggl]# rpm -ivh httpd-2.2.3-45.el5.centos.1.x86_64.rpm[root@localhost zhanggl]# cd /etc/httpd/ 

===================PHP=================
http://oss.oracle.com/projects/php/files/EL5/x86_64/ download:php53-5.3.5-1.el5.x86_64.rpm
php53-cli-5.3.5-1.el5.x86_64.rpm
php53-common-5.3.5-1.el5.x86_64.rpmphp53-gd-5.3.5-1.el5.x86_64.rpm [root@localhost php-5.3.5-rpm]# rpm -ivh php53-mysql-5.3.5-1.el5.x86_64.rpm
error: Failed dependencies:
        libmysqlclient.so.15()(64bit) is needed by php53-mysql-5.3.5-1.el5.x86_64
        libmysqlclient.so.15(libmysqlclient_15)(64bit) is needed by php53-mysql-5.3.5-1.el5.x86_64 下载mysql-shared-compat来解决http://rpm.pbone.net/index.php3/stat/4/idpl/16852352/dir/redhat_el_5/com/MySQL-shared-compat-5.5.15-1.rhel5.x86_64.rpm.html [root@localhost php-5.3.5-rpm]# rpm -ivh MySQL-shared-compat-5.5.15-1.rhel5.x86_64.rpm [root@localhost php-5.3.5-rpm]# rpm -ivh php53-mysql-5.3.5-1.el5.x86_64.rpm
Preparing...                ########################################### [100%]
   1:php53-mysql            ########################################### [100%] 
配置文件:/etc/php.ini
====================Mysql===============
wget ftp://ftp.ntu.edu.tw/pub/MySQL/Downloads/MySQL-5.5/MySQL-client-5.5.15-1.rhel5.x86_64.rpm
wget ftp://ftp.stu.edu.tw/pub/Unix/Database/Mysql/Downloads/MySQL-5.5/MySQL-server-5.5.15-1.rhel5.x86_64.rpm

执行安装命令
rpm -ivh MySQL-server-5.5.15-1.rhel5.x86_64.rpm
rpm -ivh MySQL-client-5.5.15-1.rhel5.x86_64.rpm
安装完以后,就可以启动了
service mysql start
service mysql stop
service mysql restart    修改密码./mysqladmin -u root password ‘passwd’ 开启远程访问mysqlgrant all privileges on *.* to root@localhost identified by 'passwd';grant all privileges on *.* to root@'%' identified by 'passwd';mysql> flush privileges;mysql> select * from mysql.user;



====================memcache===============
libevent-2.0.12-stable.tar.gz memcached-1.4.6.tar.gzmemcache-2.2.6.tgz


2.先安装libevent:
# tar zxvf libevent-2.0.12-stable.tar.gz

# cd libevent-2.0.12-stable

# ./configure –prefix=/usr
# make
# make install



4.安装memcached,同时需要安装中指定libevent的安装位置:
# tar zxvf memcached-1.4.6.tar.gz

# cd  memcached-1.4.6

# ./configure –with-libevent=/usr
# make
# make install

安装完成后会把memcached放到 /usr/local/bin/memcached

启动memcached:

/usr/local/bin/memcached -d -m 10 -u root -l 127.0.0.1 -p 12000 -c 256 -P /tmp/memcached.pid



2.安装PHP的memcache扩展tar vxzf memcache-2.2.6.tgzcd memcache-2.2.6phpize

./configure --enable-memcache


make

make install


Installing shared extensions:     /usr/lib64/php/modules/ 




若找不到phpize,则安装php53-devel-5.3.5-1.el5.x86_64.rpm,可能还需要先安装autoconf213

yum install autoconf213

rpm -ivh php53-devel-5.3.5-1.el5.x86_64.rpm 

在/etc/php.ini中把memcache.so加上去

extension_dir = "/usr/lib64/php/modules/"

extension = memcache.so



memcache有个图形化管理工具,叫memadmin。