ubuntu linux下源碼編譯安裝lamp環境

  1. 安裝zlib庫

    tar -zvxf zlib-1.2.8.tar.gz  

    cd zlib-1.2.8

    ./configure

    make && make install

   2.安裝apache2.4.23

        tar -zvxf httpd-2.4.23.tar.gz

        cd httpd-2.2.23

        ./configure  --prefix=/usr/local/http2 \ 

        --enable-modules=all \          //支持動態,靜態加載模塊

        --enable-rewrite \    #支持重寫

        --enable-mods-shared=all \     

        --enable-so            #讓apache核心裝載dso

##出錯  err:APR not found   //缺少APR 庫

  則安裝APR

    tar -zvxf apr-1.5.2.tar.gz

    cd apr-1.5.2

    ./configure --prefix=/usr/local/apr

    ##出錯  err:cannot remove "libtoolT":No such fileor directory

    解決方案是 安裝libtool  

        sudo apt-get install libtool

        重新編譯安裝apr

        make && make install

    apr 安裝成功

    

//重新編譯安裝apache



##又出錯

    APR-Uitl not found  

    跟apr 同類的錯誤

    安裝apr-util

tar -zvxf APR-util-1.5.4.tar.gz

cd APR-util-1.5.4

./configure --prefix=/usr/local/apr-util

   make && make install

在繼續重新編譯apache

##錯誤  ,仍未找到APR-util  

解決:在apache 的./configure編譯命令後面加上--with-apr-util=/usr/local/apr-util


繼續編譯安裝apache

錯誤:pcre not found

安裝pcre  

  tar -zvxf pcre-8.3.8.tar.gz

./configure

make && make install



//繼續編譯安裝apache

未報錯,安裝成功

啓動apache

    cd /usr/local/http2/bin

    ./apachectl start


##報錯

error while loading shared librarles:libpcre.so1 :cannot open shared object file:No such file or drectory

解決方法

查看系統中是否存在libpcre.so.1

find / -name "libpcre.so.1"

  //發現該文件存在,在/usr/local/lib目錄下

 運行ldconfig命令   

ldconfig命令的用途, 主要是在默認搜尋目錄(/lib和/usr/lib)以及動態庫配置文件/etc/ld.so.conf內所列的目錄下, 搜索出可共享的動態鏈接庫(格式如lib*.so*), 進而創建出動態裝入程序(ld.so)所需的連接和緩存文件. 緩存文件默認爲/etc/ld.so.cache, 此文件保存已排好序的動態鏈接庫名字列表. 

在運行Idd httpd命令顯示httpd的依賴關係,若顯示有該文件目錄,則加載成功

再次啓動apache 成功  



安裝libxml2

tar-zxvf libxml2-2.9.3.tar.gz

cd libxml2-2.9.3

./configure --prefix=/usr/local/libxml2

make && make install


安裝jpeg8


tar -zxvf jpegsrc.v8b.tar.gz

cd jpeg-8b

./configure --prefix=/usr/local/jpeg --enable-share --enable-static

make && make install


安裝libpng

tar -zvxf libpng-1.6.24

./configure

make && make install


安裝freetype

tar -zxvf freetype

cd freetype-2.6.5

./configure --prefix=/usr/local/freetype

make && make install


安裝gd庫

tar -zvxf gd-2.035.tar.gz

cd gd-2.035

./configure --prefix=/usr/local/gd --with-jpeg=/usr/local/jpeg --with-png --with-zlib  --wit-freetype=/usr/local/freetype

提示版本低,需大於2.10

換個版本,按上述步驟重新安裝


安裝php5

tar -zvxf php-5.6.24

cd php-5.6.24

./configure --prefix=/usr/local/php \

--with-apx2=/usr/local/http2/bin/apaxs \

--with-mysql=mysqlnd \

--with-mysqli=mysqlnd \

--with-pdo-mysql=mysqlnd \

--with-freetype-dir=/usr/local/freetype \

--with-gd=/usr/local/gd \

--with-zlib --with-libxml-dir=/usr/local/libxml2 \

--with-jpeg-dir=/usr/local/jpeg \

--with-png-dir \

--enable-mbstring=all \

--enable-mbregex \

--enable-shared


make && make install

##錯誤X11/xpm.h no such file or directory   原因,gd庫不支持Xpm


 解決

下載ibXpm-dev的deb類型的文件,點擊安裝,並重新編譯安裝gd


再次重新編譯安裝php,ok

cp php.ini-development  /usr/local/php/lib/php.ini   //拷貝php配置文件



配置apache,使其支持php


vi /usr/local/http2/conf/httpd.conf

//讓apache支持php,添加如下代碼

AddType application/x-httpd-php .php


<IfModule dir_module>

    DirectoryIndex index.html

<IfModule>

在index.html 前面家加上index.php




發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章