参考:???
安装mysql
sudo apt-get insall mysql-server mysql-client mysql-common
安装apache 下载apache的源码包,并解压,进入解压后的源码包
./configure --prefix=/usr/local/apache --with-enable=so
--enable-expires=shared --enable-setenvif=shared --enable-rewrite=shared
--enable- deflate=shared --with-expat=builtin --enable-mime-magic=shared
--enable- expires=shared --enable-headers=shared --with-mpm=worker
--with-threads=yes
[edit ] 安装PHP
下载php的源码包,并解压,进入解压后的源码包
sudo apt-get install libjpeg-dev libjpeg62 libjpeg62-dev zlib1g-dev libfreetype6 libfreetype6-dev
sudo apt-get install curl
sudo apt-get install libcurl
sudo apt-get install libcurl4-openssl-dev
sudo apt-get install libjpeg8 libjpeg8-dev
sudo apt-get install libpng libpng12-dev
sudo apt-get install libpng12-0 libpng12-dev
sudo apt-get install libmhash-dev libmhash2
sudo apt-get install libmysqld-dev
sudo apt-get install libmysqlclient-dev
sudo apt-get install libxml2
sudo apt-get install libxml2-dev
sudo apt-get install g++
sudo apt-get install libmcrypt-dev
./configure --prefix=/usr/local/php
--with-config-file-path=/usr/local/lib --with-curl
--with-apxs2=/usr/local/apache/bin/apxs --with-mysql
--with-pdo-mysql --with-gd --enable-mbstring --with-gettext
--with-mhash --with-gd --with-jpeg-dir --with-png-dir --with-ttf
--with-freetype-dir
以上是我参考的内容,下面就是我在ubuntu10.10下面用源代码编译安装Lamp环境的过程:
首先我选择安装apache,使用如下配置:
./configure --prefix=/usr/local/apache --with-enable=so --enable-expires=shared --enable-setenvif=shared --enable-rewrite=shared --with-expat=builtin --enable-mime-magic=shared --enable-expires=shared --enable-headers=shared --with-mpm=worker --with-threads=yes
(注:apache版本为httpd-2.2.17)
然后make & make install顺利安装成功
然后安装mysql,简单的话一般用二进制安装包安装在/usr/local/mysql目录下面
解压mysql-5.1.53-linux-i686-glibc23到目录/usr/local下,然后建立一个符号连接,ln -s mysql-5.1.53-linux-i686-glibc23 mysql
接着,运行scripts/mysql_install_db ,安装成功.
最后安装php5,使用如下配置:
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/lib --with-curl --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --with-pdo-mysql=/usr/local/mysql --with-gd --enable-mbstring --with-gettext --with-mhash --with-gd --with-jpeg-dir --with-png-dir --with-ttf --with-freetype-dir
由于配置中启用了很多扩展模块,而这些扩展模块依赖其他一些软件,所以必须首先安装这些依赖软件包。
a.安装libxml2
./configure 和make & make install顺利安装
(注:libxml2_2.7.8)
b.安装curl
./configure 和make & make install顺利安装
(注:curl-7.21.3)
c.安装libjpeg
./configure 和make & make install顺利安装
(注:libjpeg8_8b)
d.安装libpng 先安装zlib依赖包(注:zlib-1.2.5)
./configure 和make & make install顺利安装
(注:libpng-1.4.4)
e.安装freetype
./configure 和make & make install顺利安装
(注:libpng-1.4.4)
f.安装mhash
./configure 和make & make install顺利安装
(注:mhash-0.9.9.9)
最后可以顺利安装php5了
但是还有一点apache的配置文件需要修改才能真正使用php。 编辑http.conf,
在DirectoryIndex 后面添加 index.php
在最后添加
AddType application/x-httpd-php .php .phtml .php3 .inc
AddType application/x-httpd-php-source .phps