you are better than you think

APM编译安装

· Read in about 1 min · (153 Words)
Linux 手工活

软件包存放路径:/home/thur/opdir/soft,部署路径:/home/thur/local/

soft目录下有AMP和freetype,jpeg,libpng,mhash,php,curl,gd,libmcrypt,libxml,zlib安装包;

tar zxvf 相应的安装包.tar.gz

一 准备

首先在/home/thur/local下建立相应的目录,

mkdir -p /home/thur/local/{apache,freetype,jpeg,libpng,mhash,php,curl,gd,libmcrypt,libxml,mysql,zlib}

二、安装Apache

1、进入解压的Apache目录,执行

./configure --prefix=/home/thur/local/apache
make
make install

然后分别安装 freetype,jpeg,libpng,mhash,curl,gd,libmcrypt,libxml,步骤一样,将路径作相应的替换。

注:在安装zlib的时候需要特别注意一下,因为机器是64位的,因此,需要设置gcc编译参数,否则在执行php make时会报错。

CFLAGS="-O3 -fPIC" ./configure –prefix=/home/thur/local/zlib /*我是注释:是大欧,不是零*/
make
make install

2、修改apache/conf/http.conf

(1)

40 Listen 80

修改为

40 Listen 8000

注:只有root权限运行的Apache才能监听1024以下的端口。

(2)

<IfModule dir_module>
DirectoryIndex index.html
</IfModule>

修改为

<IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule>

(3)

308 AddType application/x-compress .Z
309 AddType application/x-gzip .gz .tgz

修改为

308 AddType application/x-compress .Z
309 AddType application/x-gzip .gz .tgz
310 AddType application/x-httpd-php .php

三 安装 MySQL

安装MySQL

./configure --prefix=/home/thur/local/mysql --with-charset=utf8 --with-extra-charsets=gbk,utf8,ascii,big5,latin1,binary --localstatedir=/home/thur/local/mysql --with-plugins=all --with-pthread --enable-static --enable-thread-safe-client --enable-assembler --without-ndb-debug --with-unix-socket-path=/home/thur/local/mysql/tmp/mysql.sock --with-mysqld-user=thur
make
make install
mkdir -p /home/thur/local/mysql/{tmp,log,data,etc}
touch /home/thur/local/mysql/tmp/mysql.sock
/home/thur/local/mysql/bin/mysql_install_db –datadir=/home/thur/local/mysql/data
cp /home/thur/local/mysql/support-files/my-huge.cnf /home/thur/mysql/etc/my.cnf
cd /home/thur/local/mysql/etc

vi my.cnf 将数据目录和套接字文件修改为实际值

启动MySQL

/home/thur/local/mysql/bin/mysqld_safe &

四 安装PHP

安装PHP

./configure --prefix=/home/thur/local/php --with-apxs2=/home/thur/local/Apache/bin/apxs --with-mysql=/home/thur/local/mysql --with-pdo-mysql=/home/thur/local/mysql --with-mysqli=/home/thur/local/mysql/bin/mysql_config --with-mhash=/home/thur/local/mhash --with-libxml-dir=/home/thur/local/libxml --with-gd=/home/thur/local/gd --with-png-dir=/home/thur/local/libpng --with-jpeg-dir=/home/thur/local/jpeg --with-freetype-dir=/home/thur/local/freetype --with-mcrypt=/home/thur/local/libmcrypt --with-zlib-dir=/home/thur/local/zlib --enable-bcmath --enable-ftp --enable-sockets --enable-wddx --enable-mbstring --without-sqlite --enable-shmop --with-curl=/home/thur/local/curl
make
make install

五 验证

新建一个test.php,内容为

<?php echo phpinfo() ?>

启动Apache

/home/thur/local/apache/bin/apachectl start

Comments