一、软件下载
分别下载软件以下软件:
Apache-2.0.43(www.apache.org)
Php-4.2.3(www.php.net)
Mysql-3.23.53(www.mysql.com)
二、准备安装
由于本人将所有软件的源代码放置在目录/home/src下,安装目录为/server,下载后的源代码包在/root目录下,故执行以下操作:
mkdir/home/src
mkdir/server
groupaddmysql
useradd-gmysql-d/home/mysqlmysql//建立mysql组及用户
cd/home/src
tarzxvf/root/mysql-3.23.53.tar.gz
tarzxvf/root/httpd-2.0.43.tar.gz
tarzxvf/root/php-4.2.3.tar.gz
三、安装配置过程
使用vi编辑一shell文件,内容如下:
cd/home/src/mysql-3.23.53
./configure--prefix=/server/mysql
make
makeinstall
/server/mysql/bin/mysql_install_db
chown-Rroot/server/mysql
chgrp-Rmysql/server/mysql
chown-Rroot/server/mysql/bin
chgrp-Rmysql/server/mysql/bin
chown-Rroot/server/mysql/var
chgrp-Rmysql/server/mysql/var
chmod777/server/mysql/var
chown-Rroot/server/mysql/var/mysql
chgrp-Rmysql/server/mysql/var/mysql
chmod777/server/mysql/var/mysql
chown-Rroot/server/mysql/var/mysql/*
chgrp-Rmysql/server/mysql/var/mysql/*
chmod777/server/mysql/var/mysql/*
chmod777/server/mysql/lib/mysql/libmysqlclient.a
#安装mysql-3.23.53
cd/home/src/httpd-2.0.43
./configure--prefix=/server/apache--enable-so
make
makeinstall
#安装Apache-2.0.43
cd/home/src/php-4.2.3
./configure--with-mysql=/server/mysql--with-apxs2=/server/apache/bin/apxs
--eable-track-vars--enable-force-cgi-redirect--enable-pic
--enable-inline-optimiation--enable-memory-limit--enable-bcmath
--enable-shmop--enable-versioning
-enable-calendar--enable-dbx--enable-dio--enable-mcal
--with-config-file-path=/server/apache/conf
make
makeinstall
cpphp.ini-dist/server/apache/conf/php.ini
#安装php-4.2.3,以上某些模块可不使用,--with-config-file-path=/server/apache/conf指定
#php的配置文件在目录/server/apache/conf
ln-s/server/apache/bin/apachectl/bin/apache
ln-s/server/mysql/bin/mysql/bin/mysql
#创建符号连接
四、修改配置文件
vi/server/apache/conf/httpd.conf
#加入以下行(装载php4模块并指定.php文件)
#LimitRequestBody(指定php处理的请求数据大小,以下指定为20M)
LoadModulephp4_modulemodules/libphp4.so
<Files*.php>
SetOutputFilterPHP
SetInputFilterPHP
LimitRequestBody20971520
</Files>
#注解以下行(在文本前加#),使apache显示中文,具体原因未知
ForceLanguagePriorityPreferFallback
AddDefaultCharsetISO-8859-1
#加入默认的引导文件index.php(找到DirectoryIndex,修改如下:)
DirectoryIndexindex.htmlindex.html.varindex.php
#指定网站目录(假设为/apache目录)
DocumentRoot"/apache"
vi/server/apache/conf/php.ini
#找到并修改以下参数
max_execution_time=600;最大运行时间600秒
max_input_time=600;最大输出时间600秒
memory_limit=20M;最大内存限制20M
file_uploads=On;允许上载文件
upload_max_filesize=20M;最大文件大小20M
post_max_size=20M;php可接受的post方法大小20M
session.auto_start=1;session自动启动
五、运行
#启动mysql
/server/mysql/bin/safe_mysqld--user=mysql&
#停止mysql
/server/mysql/bin/mysqladminshutdown
#启动apache
apachestart
#停止apache
apachestop
mkdir/apache
echo"<?">/apache/index.php
echo"phpinfo();">>/apache/index.php
echo"?>">>/apache/index.php
#生成/apache/index.php文件
在浏览器上输入linux机器网址,php的配置信息将显示出来。