久久精品国产清自在天天线_日韩国产欧美系列_亚洲天堂影视在线观看_91在线艹亚洲无码午夜_日本写真高清视频免费网站网_亚州无码大尺度另类_高跟翘臀老师后进式视频午夜_久久精品国产亚洲AV热黑人_国产另ts另类人妖_丁香五月 开心五月 激情五月

當(dāng)前位置:首頁 > 嵌入式培訓(xùn) > 嵌入式學(xué)習(xí) > 講師博文 > Linux 下搭建Apache 服務(wù)器

Linux 下搭建Apache 服務(wù)器 時(shí)間:2018-09-25      來源:未知

在開發(fā)過程中尤其實(shí)在開發(fā)web程序時(shí),我們經(jīng)常需要測試web程序是否運(yùn)行·正�;蛘邷y試結(jié)果是否正確,因此我們需要有一個(gè)可以運(yùn)行web程序的服務(wù)器。大家也都知道web服務(wù)器的種類很多,可以根據(jù)不同的需求來選擇不同的web server。但是長用的莫過于Apache和Nginx了。對于這兩個(gè)服務(wù)器我們都可以到對應(yīng)的官方站點(diǎn)進(jìn)行下載安裝。

直接安裝下載好的二進(jìn)制包的確很方便和簡單,但是有時(shí)候現(xiàn)成的安裝包可能無法提供我們需要的一些特定的功能,那么怎么辦呢?今天我們就分享一下在linux下如何通過源碼來編譯安裝Apache和所需的模塊。具體步驟,如下:

一、安裝apache

1、安裝apache

#tar -zxvf httpd-2.2.22.tar.gz

#cd httpd-2.2.22

#./configure --enable-moudle=so --prefix=/usr/local/apache

出現(xiàn)錯誤 apr not found 錯誤:

解決辦法:

1.下載所需軟件包:

wget //archive.apache.org/dist/apr/apr-1.4.5.tar.gz

wget //archive.apache.org/dist/apr/apr-util-1.3.12.tar.gz

wget //jaist.dl.sourceforge.net/project/pcre/pcre/8.10/pcre-8.10.zip

a:解決apr not found問題>>>>>>

[root@xt test]# tar -zxf apr-1.4.5.tar.gz

[root@xt test]# cd apr-1.4.5

[root@xt apr-1.4.5]# ./configure --prefix=/usr/local/apr

[root@xt apr-1.4.5]# make && make install

b:解決APR-util not found問題>>>>

[root@xt test]# tar -zxf apr-util-1.3.12.tar.gz

[root@xt test]# cd apr-util-1.3.12

[root@xt apr-util-1.3.12]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config

[root@xt apr-util-1.3.12]# make && make install

c:解決pcre問題>>>>>>>>>

[root@xt test]#unzip -o pcre-8.10.zip

[root@xt test]#cd pcre-8.10

[root@xt pcre-8.10]#./configure --prefix=/usr/local/pcre

[root@xt pcre-8.10]#make && make install

2、#./configure --enable-moudle=so --prefix=/usr/local/apache --with-apr=/usr/local/apr \

--with-apr-util=/usr/local/apr-util \

--with-pcre=/usr/local/pcre

3、 make && make install

4、

添加:exportPATH添加:export PATH=/usr/local/apache/bin:$PATH

啟動:httpd -k start

停止:httpd -k stop

重啟:httpd -k restart

5、修改/usr/local/apache/conf/httpd.conf文件,

設(shè)置:ServerName localhost:80

二、安裝php

1、解壓配置

./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs \

--with-mysql=/usr(如果是使用apt-get 安裝的mysql) --with-mysqli=/usr/bin/mysql_config \

--with-pear --with-libxml-dir --disable-fileinfo

出現(xiàn)錯誤,提示缺少 libxm12

apt-get install -y libxml2 libxml2-dev

2、make

make: *** [ext/fileinfo/libmagic/apprentice.lo] Error 1

編譯PHP5.5 make 時(shí)出現(xiàn)錯誤

make: *** [ext/fileinfo/libmagic/apprentice.lo] Error 1

解決辦法

這是由于內(nèi)存小于1G所導(dǎo)致.

在./configure加上選項(xiàng):

--disable-fileinfo

Disable fileinfo support 禁用 fileinfo

3、make install

4、 將php源碼包中的php.ini-development 復(fù)制到/usr/local/lib/中

cp php-5.6.13/php.ini-development /usr/local/lib/php.ini

5、修改Apache配置文件(/usr/local/apache/conf/httpd.conf)以支持對PHP的解析。

如果httpd.conf中沒有下列語句,就將它們分別添加到LoadModule和AddType項(xiàng)的后面。

LoadModule php5_module modules/libphp5.so

AddType application/x-httpd-php .php

在DirectoryIndex index.html index.html.var一行后加入index.php,即改為:

DirectoryIndex index.html index.html.var index.php

重啟Apache服務(wù)器:

#/usr/local/apache2/bin/apachectl restart

6、測試

在Apache服務(wù)器的文件根目錄(/usr/local/apache2/htdocs/)下新建一個(gè)PHP文件test.php,并輸入以下內(nèi)容:

phpinfo();

?>

在瀏覽器中輸入//localhost/test.php。

上一篇:Linux內(nèi)核中的數(shù)據(jù)結(jié)構(gòu)的一點(diǎn)認(rèn)識

下一篇:Java中內(nèi)部類的幾種表現(xiàn)形式

熱點(diǎn)文章推薦
華清學(xué)員就業(yè)榜單
高薪學(xué)員經(jīng)驗(yàn)分享
熱點(diǎn)新聞推薦
前臺專線:010-82525158 企業(yè)培訓(xùn)洽談專線:010-82525379 院校合作洽談專線:010-82525379 Copyright © 2004-2022 北京華清遠(yuǎn)見科技集團(tuán)有限公司 版權(quán)所有 ,京ICP備16055225號-5京公海網(wǎng)安備11010802025203號

回到頂部