配置环境:
Redhat Linux9.0
要求:
安装有:gcc编译器,make
软件包:
php-5.0.0b1.tar.gz
mysql-standard-4.1.0-alpha-pc-linux-i686.tar.gz
httpd-2.0.47.tar.gz
分别来自各自的官方网站.
(一) 安装
1.安装apache2
tar zxvf httpd-2.0.47.tar.gz
cd httpd-2.0.47
./configure --prefix=/usr/local/apache --enable-so
make
make install
2.安装MySQL
groupadd mysql
useradd -g mysql mysql
cd /usr/local
gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
ln -s full-path-to-mysql-VERSION-OS mysql
cd mysql
scripts/mysql_install_db
chown -R root .
chown -R mysql data
chgrp -R mysql .
运行MySQL:
./bin/mysqld_safe --user=mysql &
3.安装PHP
tar zxvf php5.0.0b1.tar.gz
cd php5.0.0b1
./configure --with-mysql=/usr/local/mysql \
--with-apxs2=/usr/local/apache/bin/apxs \
--enable-track-vars \
--with-gd --with-zlib --with-xml
make
make install
(二)配置运行
1.配置Apache
修改httpd.conf:
vi /usr/local/apache/conf/httpd.conf
DirectoryIndex后加上index.php
加一行 AddType application/x-httpd-php .php .phtml .php3 .inc
加一行 LoadModule php4_module modules/libphp4.so
AddDefaultCharset后改为??????
起动Apache:
/usr/local/apache/bin/apachectl -k start
如果想让其启动时自动运行:
vi /etc/rc.d/rc.local 加一行 /usr/local/apache/bin/apachectl start
2.配置MySQL
使其运行:
./bin/mysqld_safe --user=mysql &
使其启动时自动运行:
vi /etc/rc.d/rc.local 加一行 cd /usr/local/mysql;./bin/mysqld_safe
--user=mysql &
3.配置PHP
cp php.ini-dist /usr/local/lib/php.ini
vi /usr/local/lib/php.ini 修改 mysql.default_socket =/tmp/mysql.sock?
(三)完成配置
info.php
--------------
<?php
phpinfo();
?>
--------------
放在web目录下(/usr/local/apache/htdocs/)
在浏览器中打开