西西軟件園多重安全檢測下載網(wǎng)站、值得信賴的軟件下載站!
軟件
軟件
文章
搜索

首頁編程開發(fā)php教程 → 在Linux上安裝LAMP

在Linux上安裝LAMP

相關(guān)軟件相關(guān)文章發(fā)表評論 來源:本站原創(chuàng)時(shí)間:2010/8/20 10:53:07字體大。A-A+

作者:不詳點(diǎn)擊:128次評論:0次標(biāo)簽: LAMP 在Linux

  • 類型:ACT動(dòng)作游戲大。300M語言:中文 評分:10.0
  • 標(biāo)簽:
立即下載

所需軟件源代碼包:
httpd-2.2.4.tar.gz mysql-5.0.27.tar.gz php-5.2.1.tar.bz2
freetype-2.3.2.tar.gz gd-2.0.34.tar.gz jpegsrc.v6b.tar.gz
libpng-1.2.8.tar.bz2 libxml2-2.6.24.tar.bz2 zlib-1.2.2.tar.gz
安裝順序:apache -> mysql -> freetype -> jpegsrc.v6b -> libpng -> libxml -> zlib -> gd -> php ( freetype,jpegsrc.v6b,libxml,zlib,libpng 的安裝順序不限)
約定目錄:/usr/local/src 軟件源代碼包存放位置
/usr/local/software_name 源碼包編譯安裝位置
安裝命令:
1 apache
# cd /usr/local/src
# t ar xzvf http-2.2.4.tar.gz
# cd http-2.2.4
# ./configure \
"--prefix=/usr/local/apache2" \
"--enable-module=so" \
"--enable-deflate=shared" \
"--enable-expires=shared" \
"--enable-rewrite=shared" \
"--enable-static-support" \
"--enable-static-htpasswd" \
"--enable-static-htdigest" \
"--enable-static-rotatelogs" \
"--enable-static-logresolve" \
"--enable-static-htdbm" \
"--enable-static-ab" \
"--enable-static-checkgid" \
"--disable-userdir"
# make
# make install
# /usr/local/apache2/bin/apachectl start
出現(xiàn)錯(cuò)誤的話就是因?yàn)橛蛎年P(guān)系,直接從http.conf里面修改把域名改成本地IP
# /usr/local/apache2/bin/apachectl stop
2. mysql
# tar xzvf mysql-5.0.27.tar.gz
# cd mysql-5.0.27
# ./configure \
"--prefix=/usr/local/mysql" \
"--localstatedir=/var/lib/mysql" \
"--with-comment=Source" \
"--with-server-suffix=-Comsenz" \
"--with-mysqld-user=mysql" \
"--without-debug" \
"--with-big-tables" \
"--with-charset=" \ #這個(gè)后邊需要指定你所需要的字符集參數(shù)(utf8......)
"--with-collation= " \ #字符集校正碼(utf8_general_ci,......)
"--with-extra-charsets=all" \
"--with-pthread" \
"--enable-static" \
"--enable-thread-safe-client" \
"--with-client-ldflags=-all-static" \
"--with-mysqld-ldflags=-all-static" \
"--enable-assembler" \
"--without-isam" \
"--without-innodb" \
"--without-ndb-debug"
# make
# make install
# useradd mysql
# cd /usr/local/mysql
# bin/mysql_install_db --user=mysql
# chown -R root:mysql . (注意后面的點(diǎn))
# chown -R mysql /var/lib/mysql
# cp share/mysql/my-huge.cnf /etc/my.cnf
# cp share/mysql/mysql.server /etc/rc.d/init.d/mysqld
# chmod 755 /etc/rc.d/init.d/mysqld
# chkconfig --add mysqld
# /etc/rc.d/init.d/mysqld start (啟動(dòng)mysql)
# bin/mysqladmin -u root password "password_for_root" (改密碼)
3 安裝庫
(1)libxml
# cd /usr/local/src
# tar xjvf libxml2-2.6.24.tar.bz2
# cd libxml2-2.6.24
# ./configure --prefix=/usr/local/libxml2
# make
# make install
(2)jpeg6
建立目錄
# mkdir /usr/local/jpeg6
# mkdir /usr/local/jpeg6/bin
# mkdir /usr/local/jpeg6/lib
# mkdir /usr/local/jpeg6/include
# mkdir /usr/local/jpeg6/man
# mkdir /usr/local/jpeg6/man/man1
# cd /usr/local/src
# tar vzxf jpegsrc.v6b.tar.gz
# cd jpeg-6b
# ./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static
# make
# make install
(3)freetype
# cd /usr/local/src
# tar zvxf freetype-2.3.2.tar.gz
# cd freetype-2.3.2
# ./configure --prefix=/usr/local/freetype
# make
# make install
(4)zlib
# cd /usr/local/src
# tar zvxf zlib-1.2.2.tar.gz
# cd zlib-1.2.2
# ./configure –prefix=/usr/local/zlib
# make
# make install
(5) libpng
# cd /usr/local/src
# tar zjvf libpng-1.2.8.tar.bz2
# cd libpng-1.2.8
# cp scripts/makefile.std makefile
# make
# make install
(6)gd
# cd/usr/local/src
# tar xzvf gd-2.0.34.tar.gz
# cd gd-2.0.34
#./configure --prefix=/usr/local/gd2 --with-png=/usr/local/lib --with-zlib=/usr/local/zlib --with-freetype=/usr/local/freetype --with-jpeg=/usr/local/jpeg6 –with-libxml=/usr/local/libxml2
# make
# make install
4 php
# cd /usr/local/src
# tar xvjf php-5.2.1.tar.bz2
# cd php-5.2.1
#./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-zlib-dir=/usr/local/zlib
--with-png-dir=/usr/local/lib
--with-freetype-dir=/usr/local/freetype
--enable-xml
--enable-mbstring
--enable-sockets
# make
# make install
# cp php.ini-dist /etc/php.ini
裝完php重啟apache和mysql 看是否運(yùn)行正常,若無報(bào)錯(cuò)信息。就可以開始修改配置文件了。如果出錯(cuò),需要重新編譯,在重新編譯之前要運(yùn)行make clean或make disclean清除先前的編譯環(huán)境
整合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
注意.php前有一個(gè)空格
把DirectoryIndex index.html改成
DirectoryIndex index.html index.php
修改虛擬目錄
#vi /etc/php.ini
把register_globals = Off 改成register_globals = On
最后重啟apache mysql 寫個(gè)測試頁

若看到php信息則成功。
 

    相關(guān)評論

    閱讀本文后您有什么感想? 已有人給出評價(jià)!

    • 8 喜歡喜歡
    • 3 頂
    • 1 難過難過
    • 5 囧
    • 3 圍觀圍觀
    • 2 無聊無聊

    熱門評論

    最新評論

    發(fā)表評論 查看所有評論(0)

    昵稱:
    表情: 高興 可 汗 我不要 害羞 好 下下下 送花 屎 親親
    字?jǐn)?shù): 0/500 (您的評論需要經(jīng)過審核才能顯示)