中文字幕亚洲一区,69久久久久精品9999不卡片,亚洲国产日韩欧美在线看片,国产精品久久久久久久久岛国

龍巖易富通網(wǎng)絡(luò)科技有限公司

龍巖小程序開發(fā),龍巖分銷系統(tǒng)

Debian+Apache2+MySQL5+PHP5+GD安裝

2015.09.10 | 1108閱讀 | 0條評論 | linux


Debian+Apache2+MySQL5+PHP5+GD


所有資源來源于網(wǎng)絡(luò).本文可以任意修改,轉(zhuǎn)載,復(fù)制...

雖然是在Debian下配置的,由于是源碼包安裝的,所以應(yīng)該也適用于其他Linux發(fā)行版.


首先,準(zhǔn)備好軟件包:

  最新的Apache,MySQL和PHP可以去相對的官方網(wǎng)站去下載,下載到/tmp/src/目錄下: 

MySQL5:      http://dev.mysql.com/get/Downloa ... 27.tar.gz/from/pick

  PHP5.2.0:      http://cn2.php.net/get/php-5.2.0.tar.bz2/from/cn.php.net/mirror

  Apache2.0.59:   http://httpd.apache.org/download.cgi

  GD Library:    https://github.com/libgd/libgd/archive/gd-2.2.4.tar.gz

  Zlib:               http://www.zlib.net/zlib-1.2.11.tar.gz

  libpng :            http://prdownloads.sourceforge.n ... fig.tar.gz?download

  Jpeg v6b:        http://www.ijg.org/files/jpegsrc.v6b.tar.gz 鏈接似乎失效了,我把文件作為附件上傳上來了

  FreeType2:     http://jaist.dl.sourceforge.net/ ... etype-2.1.10.tar.gz

如果連Debian都沒有的話,可以去這里下載:http://www.phpchina.com/bbs/view ... &extra=page%3D1


所有操作都是以root用戶來進(jìn)行的.

        解壓:

        對于*.tar.gz的文件使用命令tar zxvf *.tar.gz來解壓;

        對于*.tar.bz2的文件使用命令tar jxvf *.tar.bz2來解壓.

        將mysql,php,apache以及gd安裝到/usr/local/目錄下,便于管理.

        編譯安裝MySQL:

        進(jìn)入到解壓后的mysql目錄,在終端輸入下面的命令:


./configure --prefix=/usr/local/mysql --with-mysqld-user=beinan --with-extra-charsets=all --with-unix-socket-path=/usr/local/mysql/var/mysql.sock 


--prefix=/usr/local/mysql 把mysql-4.0.16指定安裝到/usr/local/mysql目錄中;

--with-extra-charsets=all 對多語言的支持;

--with-unix-socket-path=/usr/local/mysql/var/mysql.sock 這個(gè)是指定mysql服務(wù)器啟動(dòng)后,聯(lián)機(jī)套接字文件所處的位置和文件名,也就是說,如果mysql服務(wù)器成功啟動(dòng)后,就能在/usr/local/mysql/var 目錄中看到mysql.sock文件。如果看不到,肯定是mysql啟動(dòng)不了。

--with-mysqld-user=username 這個(gè)是讓mysql服務(wù)器也能讓系統(tǒng)中普通用戶username也能啟動(dòng)mysql服務(wù)器。用普通用戶來啟動(dòng)mysql的好處是:mysql的進(jìn)程會(huì)自己死掉自動(dòng)退出。當(dāng)然root用戶也可以,不過有時(shí)mysql有些進(jìn)程死了,但不會(huì)自動(dòng)退出,root自己也殺不掉。所以用普通用戶就有這樣的好處,大多不會(huì)出現(xiàn)mysql進(jìn)程已死,但不會(huì)退出的情況;

make

make install 

現(xiàn)在MySQL已經(jīng)安裝完畢了.剩下的就是配置了.

配置MySQL:(以下操作都是以root執(zhí)行)

輸入命令:

         cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf

是將配置文件拷貝到/etc目錄下成為my.cnf,大家可以根據(jù)自己的需要選擇配置文件(配置文件在/usr/local/mysql/share/mysql/目錄下,有my-huge.cnf my-medium.cnf my-large.cnf my-small.cnf這些).

運(yùn)行

/usr/local/mysql/bin/mysql_install_db

這個(gè)命令是創(chuàng)建MySQL的授權(quán)表.

        chmod 755 /usr/local/mysql/var     //設(shè)置/usr/local/mysql/var的目錄權(quán)限為755

        chown -R username:username /usr/local/mysql/var  //如果希望使用username這個(gè)用戶來啟動(dòng)mysql的話

        /usr/local/mysql/share/mysql/mysql.server start      //啟動(dòng)mysql服務(wù)

        chown -R username:username /usr/local/mysql/      //把/usr/local/mysql目錄歸屬到username這個(gè)用戶下

        /usr/local/mysql/bin/mysqladmin -u root password 123456  //設(shè)置root用戶的密碼為123456


編譯安裝Apache進(jìn)入解壓后的apache文件夾.在終端輸入:


./configure --prefix=/usr/local/apache --enable-track-vars --enable-cgi --with-config-file-path=/usr/local/apache/conf


我大多是采用默認(rèn)的配制.


--prefix=/usr/local/apache 指定把a(bǔ)pahce安裝到/usr/local/apache目錄中;

--enable-cgi 支持CGI;

--with-config-file-path=/usr/local/apache/conf 指定把a(bǔ)pache的配制文件放在/usr/local/apache/conf中;比如httpd.conf配制文件就在這個(gè)目錄中;

--enable-track-vars 為啟動(dòng)cookie的get/post等追蹤功能編譯安裝:

make

make install 


安裝完成后,會(huì)在/usr/local/目錄下生成/usr/local/apache啟動(dòng)apache守護(hù)進(jìn)程:


/usr/local/apache/bin/apachectl start 


打開瀏覽器,輸入 http://localhost 就能看到一個(gè)apache的歡迎頁面了,這表示我們已經(jīng)成功解決了apache的安裝。

配制apache


配制文件是/usr/local/apache/conf/httpd.conf

編譯安裝的apache默認(rèn)存放主頁的位置應(yīng)該是/usr/local/apache/htdocs

這個(gè)目錄。

在httpd.conf中比較重要的幾項(xiàng):


ServerRoot "/usr/local/apache"


這是ServerRoot指定apache程序所在的的目錄,比如日志文件、配制文件等目錄.


Listen 80


apache 默認(rèn)端口80


ServerAdmin root@localhost


在這里,把管理員的信箱放上去


#ServerName new.host.name:80 


前面有#號就是注銷掉了,設(shè)置主機(jī)名.


DocumentRoot "/usr/local/apache/htdocs" 


這個(gè)是存放網(wǎng)頁的目錄,也就是說,我們應(yīng)該把網(wǎng)頁的目錄指定到哪里,這樣當(dāng)訪問網(wǎng)址時(shí),就調(diào)用這個(gè)目錄的文件.


<directory "="" opt="" apache="" htdocs"="">


這句應(yīng)該和DocumentRoot 的目錄保持一致。


#

# Possible values for the Options directive are "None", "All",

# or any combination of:

# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews

#

# Note that "MultiViews" must be named *explicitly* --- "Options All"

# doesn't give it to you.

#

# The Options directive is both complicated and important. Please see

# http://httpd.apache.org/docs-2.0/mod/core.html#options

# for more information.

#

<!--more-->

Options Indexes FollowSymLinks


#

# AllowOverride controls what directives may be placed in .htaccess files.

# It can be "All", "None", or any combination of the keywords:

# Options FileInfo AuthConfig Limit

#

AllowOverride None


#

# Controls who can get stuff from this server.

#

Order allow,deny

Allow from all


</directory>



AddDefaultCharset ISO-8859-1


這句是指定網(wǎng)頁的默認(rèn)語言的,如果網(wǎng)頁出亂中文亂碼,應(yīng)該改AddDefaultCharset 后面的值為GB2312。也就是改成下面這樣的。


找到下面的一行在后面加上index.php ,讓網(wǎng)站的默認(rèn)頁是index.php也行;


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


找到


#AddType application/x-tar .tgz


這行,在下面加一行。前面不要加#號。


AddType application/x-httpd-php .php


配制好后,我們就重啟apache后,對那個(gè)存放網(wǎng)頁的目錄執(zhí)行:


chmod 755 目錄名

chmod -R 755  目錄名


然后就重啟apache的守護(hù)進(jìn)程httpd


/usr/local/apache/bin/apachectl restart


在瀏覽器的地址欄中輸入localhost或者127.0.0.1,這樣應(yīng)該能看到頁面了吧。


如果是通過root用戶,或者其它用戶把相應(yīng)的網(wǎng)站文件復(fù)制到網(wǎng)站存放的目錄下的,要改變網(wǎng)站存放目錄中所有文件的權(quán)限,就是上面所說的chmod -R 755 目錄名.


編譯安裝PHP:

zlib:

                進(jìn)入解壓后的zlib目錄.在終端執(zhí)行以下命令:


               ./configure

               make

               make install 


freetype:

                進(jìn)入解壓后的freetype目錄,在終端執(zhí)行以下命令:

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

               make

               make install 


libpng:

                進(jìn)入解壓后的libpng目錄,在終端執(zhí)行以下命令:

               ./configure

               make

               make test

               make install 


jpeg-6b:

        進(jìn)入解壓后的jpeg-6b目錄,在終端執(zhí)行以下命令:

        mkdir /usr/local/jpeg                    

        mkdir /usr/local/jpeg/bin

        mkdir /usr/local/jpeg/lib

        mkdir /usr/local/jpeg/include

        mkdir /usr/local/jpeg/man

        mkdir /usr/local/jpeg/man/man1

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

         make

         make install 


GD Library:

進(jìn)入解壓后的gd目錄,在終端執(zhí)行以下命令:(注意不要空行)


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

make

make install 


PHP:

進(jìn)入解壓后的gd目錄,在終端執(zhí)行以下命令:(不要空行)


./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs \  
--with-gd --enable-gd --enable-gd-native-ttf --with-jpeg-dir --with-png \
--with-ttf--with-zlib --with-freetype-dir=/usr/local/freetype --enable-magic-quotes \
--with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-mbstring \
--enable-mbstring --with-mcrypt --with-openssl --with-config-file-path=/usr/local/lib \
--with-pdo-mysql --enable-pdo-mysql --with-curl

make

make install 


復(fù)制php.ini-dist為php.ini,并存放到/usr/local/php/etc/目錄下.

編輯/usr/local/php/etc/php.ini文件,找到如下的一行


;default_charset = "iso-8859-1"


在這行下面加一行


default_charset = "gb2312"


ok,現(xiàn)在在httpd.conf指定的網(wǎng)頁目錄下新建index.php,輸入



<?php 

phpinfo();

?>


保存,在瀏覽其中輸入localhost,應(yīng)該能正常顯示了吧.


贊 (

發(fā)表評論

主站蜘蛛池模板: 武定县| 南京市| 余姚市| 仁寿县| 罗城| 溆浦县| 德令哈市| 商水县| 珲春市| 如皋市| 贺兰县| 蒙自县| 广汉市| 烟台市| 颍上县| 乌审旗| 古丈县| 遵义县| 无锡市| 桂平市| 荥经县| 连山| 台安县| 凉山| 临猗县| 丰镇市| 二手房| 马公市| 鹿邑县| 天长市| 信丰县| 水富县| 扶沟县| 陈巴尔虎旗| 鄢陵县| 潜山县| 天长市| 湟源县| 富顺县| 保康县| 迁安市|