Linux下编译安装apache+php+mysql

1. 编译mysql
./configure –prefix=/usr/local/mysql –with-charset=gb2312
make
make install

groupadd mysql
useradd -g mysql mysql
cd /usr/local/mysql
chown -R mysql .
chgrp -R mysql .
scripts/mysql_install_db –user=mysql
chown -R root .
chown -R mysql data
bin/mysqld_safe –user=mysql &
cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/
以后启动就可以直接用/etc/init.d/mysql.server start
或者在rc*.d(debian 4 etch在rc2.d,其余linux系统基本在rc3.d)里面加上启动脚本
2. 编译apache
./configure –prefix=/usr/local/apache2 –enable-module-so –enable-rewrite
make
make install

3. 编译php
./configure –prefix=/usr/local/php –with-apxs2=/usr/local/apache2/bin/apxs \
–disable-debug –disable-rpath –enable-inline-optimization \
–with-mysql=/usr/local/mysql –with-gd –with-freetype-dir \
–with-png-dir –with-iconv –with-jpeg-dir –with-zlib
make
make install

cp %php_source%/php.ini-dist /usr/local/php/lib/php.ini

修改apache配置文件
vim /usr/local/apache2/conf/httpd.conf

在AddType application/x-gzip .gz .tgz下一行加入
AddType application/x-httpd-php .php

这个应该本来就有:
LoadModule php5_module        modules/libphp5.so

DirectoryIndex index.php index.html
这里加上index.php就可以了

然后重启apache
/usr/local/apache2/bin/apachectl restart

This entry was posted in Linux and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>