分类: LINUX
2010-09-21 11:29:24
1、安装MYSQL
useradd mysql
vi /etc/passwd
修改MYSQL为nologin
编译安装
./configure --prefix=/usr/local/mysql --with-extra-charsets=all --with-charset=utf8 --with-plugins=all (开启所有MYSQL数据库引擎)
make && make install
初始化库
cd /usr/local/mysql/bin
./mysql_install_db
改变MYSQL安装目录的用户所属
cd /usr/local
chown -R mysql
chown -R mysql:mysql mysql/var
启动服务
/usr/local/mysql/bin/mysqld_safe --user=mysql &
为MYSQL的ROOT设置密码
/usr/local/mysql/bin/mysqladmin -u root password 123456
让系统启动加载MYSQL库
vi /etc/ld.so.conf
/usr/local/mysql/lib/mysql
/usr/local/mysql/include/mysql
ldconfig
拷贝MYSQL的配置文件到指定目录
cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf
修改MY.CNF
max_allowed_packet=50M
这个参数是指定系统允许的导入的SQL文件的最大大小
2、安装APACHE
编译安装
./configure --prefix=/usr/local/apache --enable-rewrite=shared --enable-so --with-mpm=worker --enable-vhost-alias=shared --enable-deflate=shared --enable-cache=shared --enable-disk-cache=shared --enable-mem-cache=shared --enable-file-cache=shared
make && make install
3、安装zlib
./configure --prefix=/usr/local/zlib
make CFLAGS=-fpic
make install
4、安装libpng
make prefix=/usr/local/libpng -f scripts/makefile.linux CC=gcc ZLIBLIB=/usr/local/zlib ZLIBINC=/usr/local/zlib
make install -f scripts/makefile.linux
或者
mv scripts/makefile.linux ../makefile
vi makefile 修改prefix字段的安装路径
make && make install
5、安装libjpeg
mkdir -p /usr/local/libjpeg/bin
mkdir -p /usr/local/libjpeg/man
mkdir -p /usr/local/libjpeg/lib
mkdir -p /usr/local/libjpeg/include
mkdir -p /usr/local/libjpeg/man/man1
./configure --prefix=/usr/local/libjpeg --enable-shared --enable-static
make CFLAGS=-fpic libjpeg.a
make install
6、安装GD
./configure --prefix=/usr/local/gd --with-jpeg=/usr/local/libjpeg --with-png=/usr/local/libpng --with-zlib=/usr/local/zlib --with-freetype=/usr/local/freetype
make CFLAGS=-fpic
make install
make
make install
7、安装Libxml2
./configure --prefix=/usr/local/libxml2
make && make install
8、安装Libiconv
./configure --prefix=/usr/local/libiconv
make && make install
9、安装FREETYPE
./configure --prefix=/usr/local/freetype
make
make install
10、安装fontconfig
make
make install
10、安装PHP
./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/apache/bin/apxs --with-gd=/usr/local/gd --with-jpeg-dir=/usr/local/libjpeg --with-png-dir=/usr/local/libpng --with-zlib-dir=/usr/local/zlib --with-libxml-dir=/usr/local/libxml2 --with-iconv-dir=/usr/local/libiconv --with-freetype-dir=/usr/local/freetype --enable-sockets --with-curl --with-pear --enable-gd-native-ttf --with-ttf
make
make install
--with-pdo-mysql=/home/mosys/php-5.2.5/ext/pdo_mysql
这个必须要先生成PDO_MYSQL.so文件
源码目录下的ext/pdo_mysql/
phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-zlib-dir=/usr/local/zlib --with-pdo-mysql=/usr/local/mysql
make
make install
mysqli 源码目录下ext/mysqli/
phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-mysqli=/usr/local/mysql/bin/mysql_config
make
make install
测试Mysqli运行状况:
Vim mysqli.php
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
printf("Host information: %s\n", $mysqli->host_info);
/* close connection */
$mysqli->close();
?>
11、安装ZEND加速
./install.sh
a------安装目录(自动)
b------指定本机php.ini存放的路径 (这里是/usr/local/php/lib)
c------指定APACHE的服务的启动路径(自动)
12、vi /usr/local/php/lib/php.ini
13、vi /usr/local/apache/conf/httpd.conf
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php-source .phps
DirectoryIndex index.php index.php3 index.phtml index.htm
到此安装全部结束
PHP安装报错
/usr/bin/ld: /usr/local/lib/libz.a(crc32.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libz.a: could not read symbols: Bad value
解决方法如下:
cd zlib-1.2.3 //进入zlib目录
CFLAGS="-O3 -fPIC" ./configure
make
make install
PHP安装报错
/usr/bin/ld: /usr/local/lib/libz.a(crc32.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libz.a: could not read symbols: Bad value
解决方法如下:
cd zlib-1.2.3 //进入zlib目录
CFLAGS="-O3 -fPIC" ./configure
make
make install
chinaunix网友2010-09-21 16:29:19
很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com