日期:2012-10-06  浏览次数:20449 次

静态/动态编译Apache+php+mysql

所需软件:

apache:1.3.27

php: 4.3.2

mysql:4.0.13

首先来安装mysql

tar zvxf mysql-4.0.13.tar.gz

cd mysql-4.0.13

./configure --prefix=/usr/local/mysql --sysconfdir=/etc --localstatedir=/var/lib/mysql

make

make install

安装完成。

然后初始化数据库

/usr/local/mysql/bin/mysql_install_db --user=mysql

设置权限:

chown -R root /usr/local/mysql

chown -R mysql /usr/local/mysql/var

chgrp -R mysql /usr/local/mysql

复制配置文件;

cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf

启动mysql:

/use/local/mysql/bin/mysqld_safe --user=mysql &

修改密码:初始的root密码是空的

/usr/local/mysql/bin/mysqladmin -u root -p password 123456

enter password:

把密码修改为123456,由于初始密码为空,所以enter password直接回车就行

测试一下新的密码:

mysql -u root -p mysql

enter password:123456

如果顺利的话就能进入mysql。

首先是apache1.3.29+php4.3.4+mysql4.0.13的静态编译

apache第一次编译,并不要安装,因为php的编译需要apache至少已经编译过一次

tar zvxf apache_1.3.27.tar.gz

cd apache_1.3.27

./configure --prefix=/usr/local/apache

编译php

tar zvxf php4.3.4.tar.gz

cd php4.3.4

./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql \

--with-apache=../apache_1.3.27

make

make install

第二次编译安装apache:

cd ../apache_1.3.29./configure --prefix=/usr/local/apache \ --activate-module=src/modules/php4/libphp4.a makemake install cp ../php4.3.4/php.ini.dist /usr/local/php/lib/php.ini 修改/usr/local/apache/conf/httpd.conf 查找<IfModule mod_mime.c>

在此范围添加

AddType application/x-httpd-php .php

AddType application/x-httpd-php-source .phps

注意:apache和php的源码包在同一个目录,--with-apache=../apache_1.3.27是指向源码解压的目录