在linux上面LAMP安装
1. Apache安装
1. download httpd 2.2.16
# mkdir -p /usr/local/apache2
生成/usr/local/apache2目录
2. ./configure \
??? --prefix=/usr/local/apache2 \
??? --enable-so \
??? --enable-mods-shared=all \
??? --with-included-apr \
??? --enable-proxy=shared \
??? --enable-cache=shared \
??? --enable-file-cache=shared \
??? --enable-disk-cache=shared \
??? --enable-mem-cache=shared
?
if compile error show zlib not found, then use command check:
rpm -qa | grep -i zlib
if zlib is already installed, zlib-devel is needed to be installed:
yum install zlib-devel
?
we can use ./configure -help | grep mpm to see module options. After installation, we can use httpd -l? to see compiled modules.
??? make
??? make install
?
# vi /usr/local/apache2/conf/httpd.conf# cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld
# chkconfig --add mysqld
用ntsysv设置使mysql每次启动都能自动运行。
好了,至此mysql安装完毕,你可以这样起动你的mysql服务
# /etc/rc.d/init.d/mysqld start
下面这步比较关键,
# ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql
# ln -s /usr/local/mysql/include/mysql /usr/include/mysql
大家可以不做这步,大可以在编译其他软件的时候自定义myslq的库文件路径,但我还是喜欢把库文件链接到默认的位置,这样你在编译类似PHP,Vpopmail等软件时可以不用指定mysql的库文件地址。
?四,安装PHP5php5必须有libxml2支持!
安装libxml2
# cd /root
# tar -zxvf libxml2-2.6.19.tar.gz
# cd libxml2-2.6.19
# mkdir -p /usr/local/libxml2
# ./configure --prefix=/usr/local/libxml2
# make# make install
?安装php5
# cd /root
# tar -zvxf php-5.2.9.tar.gz?
# mkdir -p /usr/local/php
# cd php-5.2.9
# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs
--with-mysql=/usr/local/mysql/
--with-curl=/usr/local/curl --enable-ftp
--with-libxml-dir=/usr/local/libxml2
--with-gd=/usr/local/gd2/
--with-jpeg-dir=/usr/local/jpeg6/
--with-zlib-dir=/usr/local/zlib/
--with-png-dir=/usr/local/libpng/
--with-freetype-dir=/usr/local/freetype/ --enable-mbstring
# make
# make install
# cp php.ini-dist /usr/local/php/lib/php.ini (别忘记了)
其中./configure 后的
--prefix=/usr/local/php
--with-apxs2=/usr/local/apache2/bin/apxs
--with-mysql=/usr/local/mysql/
--with-libxml-dir=/usr/local/libxml2
是必要的选项
--with-gd=/usr/local/gd2/
--with-jpeg-dir=/usr/local/jpeg6/
--with-png=/usr/local/lib
--with-zlib-dir=/usr/lib
--with-freetype-dir=/usr/local/freetype
这是让PHP支持GD库的配置选项
--with-curl=/usr/local/curl 支持CURL库
--enable-ftp 打开FTP库函数支持
--enable-soap --with-xsl=/usr/local/libxslt --enable-xslt
让PHP支持SOAP, 上面这些一般用得少, 可以去掉
?五,安装 ZendOptimizer?# cd /root# tar -zxvf ZendOptimizer-3.3.0a-linux-glibc21-i386.tar.gz# cd ZendOptimizer-3.3.0a-linux-glibc21-i386# ./install.sh然后出现图形界面,按提示Next
?六,配置一些信息配置 httpd.conf 让apache支持PHP
# vi /usr/local/apache2/conf/httpd.conf
找到 AddType application/x-gzip .gz .tgz 在其下添加如下内容
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
重启apache
# /usr/local/apache2/bin/apachectl restart
在你设置的目录里建一内容为 <? phpinfo(); ?> PHP文件, 输入URL地址查看PHP配置是否正确