电竞比分网-中国电竞赛事及体育赛事平台

分享

linux+apache+sqlite+php

 -飛龍?jiān)谔? 2011-01-19

 2008-03-28 13:23:10 

一.安裝expect-5.42.1-1.i386.rpm

rpm -ivh expect-5.42.1-1.i386.rpm

二.sqlite 安裝配置

1. tar xzvf sqlite-3.3.8.tar.gz

2. cd sqlite-3.3.8

3. ./configure --disable-tcl --prefix=/usr/local/sqlite3

4. make

5. make install

6. make doc

7. cp /usr/local/sqlite3/include /usr/include

8. cp /usr/local/sqlite3/lib/lib* /usr/lib/

9. cp /usr/local/sqlite3/bin/sqlite3 /bin/

三.安裝apache

1.  tar xzvf httpd-2.2.3.tar.gz

2.  cd httpd-2.2.3

3.  ./configure --prefix=/usr/local/apache2 --enable-module=so --enable-so

4.  make

5.  make install

四.安裝php

php 5 安裝配置

1. tar xzvf php-5.2.0.tar.gz

2. cd php-5.2.0

2. ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --enable-pdo=shared --with-sqlite=shared --with-pdo-sqlite=shared --with-zlib

#使用默認(rèn)安裝的apache的話,此目錄為--with-apxs2=/usr/sbin/apxs,其它不變;我在我的RHEL6中,系統(tǒng)已經(jīng)安裝好apache的情況下,用此選項(xiàng)配置
編譯的PHP總是無法裝載PDO,不知為何,改用靜態(tài)編譯就沒問題,即選項(xiàng)修改為 --enable-pdo --with-sqlite --with-pdo-sqlite 其他選項(xiàng)不變

       3  make

4  make install

5. cp php-5.2.0/php.ini-dist /usr/local/php/lib/php.ini

6. cp /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/ /usr/local/php/include/php/ext/pdo/

五. 配置 /usr/local/php/lib/php.ini

1. 修改extension_dir = "/"

; Directory in which the loadable extensions (modules) reside.

extension_dir = "/usr/local/php/include/php/ext/pdo/"

; Whether or not to enable the dl() function.  The dl() function does NOT work

; Windows Extensions

; Note that ODBC support is built in, so no dll is needed for it.

; Note that many DLL files are located in the extensions/ (PHP 4) ext/ (PHP 5)

; extension folders as well as the separate PECL DLL download (PHP 5).

; Be sure to appropriately set the extension_dir directive.

2. 增加extension

extension=pdo.so

extension=pdo_sqlite.so

extension=sqlite.so

;extension=php_mbstring.dll

;extension=php_bz2.dll

;extension=php_curl.dll

;extension=php_dba.dll

;extension=php_dbase.dll
#test php with : 'php -m' at the command line and solve any issues from there. Mostly php.ini config issues. Also restart the http service!

六 修改/usr/local/apache2/conf/httpd.conf文件;

1. 修改ServerAdmin

 ServerAdmin: Your address, where problems with the server should be

# e-mailed.  This address appears on some server-generated pages, such

# as error documents.  e.g. admin@your-domain.com

#

ServerAdmin dingy@keyou.cn

#

# ServerName gives the name and port that the server uses to identify itself.

# This can often be determined automatically, but we recommend you specify

# it explicitly to prevent problems during startup.

2. 修改ServerName

# If your host doesn't have a registered DNS name, enter its IP address here.

#

#ServerName www.:80

ServerName www.

#

# DocumentRoot: The directory out of which you will serve your

# documents. By default, all requests are taken from this directory, but

3. 增加AddDefaultCharset gb2312

AddDefaultCharset gb2312

4. 可選[修改apache默認(rèn)目錄:]

# documents. By default, all requests are taken from this directory, but

# symbolic links and aliases may be used to point to other locations.

#

DocumentRoot "/usr/local/apache2/htdocs"

#

# Each directory to which Apache has access can be configured with respect

# to which services and features are allowed and/or disabled in that

DocumentRoot "/var/www/html/HAC/www/"

<Directory "/var/www/html/HAC/www/">

-----------------------------------------------------------

5. 增加php type

    # Filters allow you to process content before it is sent to the client.

    #

    # To parse .shtml files for server-side includes (SSI):

    # (You will also need to add "Includes" to the "Options" directive.)

    #

    #AddType text/html .shtml

    #AddOutputFilter INCLUDES .shtml

    AddType application/x-httpd-php .php .phtml

    AddType application/x-httpd-php-source .phps

</IfModule>

七. 啟動(dòng), 關(guān)閉Apache 服務(wù)器:

   /usr/local/apache2/bin/apachectl start

    /usr/local/apache2/bin/apachectl stop.

八. 測(cè)試,在apache 的主目錄下增加info.php 文件

info.php文件內(nèi)容如下

<?php

       phpinfo();

?>

通過web測(cè)試,web頁(yè)面上找到sqlite,pdo_sqlite項(xiàng)說明安裝成功
 
 
 
**************************
If you install PHP as an Apache module, you can consider the following. Instead of adding:

application/x-httpd-php    php
application/x-httpd-php-source    phps

into Apache mime.types, you can add:

AddType application/x-httpd-php    .php
AddType application/x-httpd-php-source    .phps

into Apache httpd.conf, OR you can add:

AddHandler application/x-httpd-php    .php
AddHandler application/x-httpd-php-source    .phps

into Apache httpd.conf. The last one is the preferred way of configuration, but it does not work in previous Apache versions.
 
-----------------
告知 Apache 將特定的擴(kuò)展名解析成 PHP,例如,讓 Apache 將擴(kuò)展名 .php 解析成 PHP。為了避免潛在的危險(xiǎn),例如上傳或者創(chuàng)建類似exploit.php.jpg的文件并被當(dāng)做 PHP 執(zhí)行,我們不再使用 Apache 的 AddType 指令來設(shè)置。參考下面的例子,你可以簡(jiǎn)單的將需要的擴(kuò)展名解釋為 PHP。我們演示為增加.php。
 
<FilesMatch \.php$>
    SetHandler application/x-httpd-php
</FilesMatch>
 
或者,你也想將 .php, .php2, .php3, .php4, .php5, .php6, 以及 .phtml 文件都當(dāng)做 PHP 來運(yùn)行,我們無需額外的設(shè)置,僅需按照下面這樣來:
<FilesMatch "\.ph(p[2-6]?|tml)$">
    SetHandler application/x-httpd-php
</FilesMatch>
然后,可以將 .phps 文件由 PHP 源碼過濾器處理,使得其在顯示時(shí)可以高亮源碼,設(shè)置如下:
<FilesMatch "\.phps$">
    SetHandler application/x-httpd-php-source
</FilesMatch>
mod_rewrite 也有助于將那些不需要運(yùn)行的 .php 文件的源碼高亮顯示,而并不需要將他們更名為 .phps 文件:
RewriteEngine On
RewriteRule (.*\.php)s$ $1 [H=application/x-httpd-php-source]
不要在正式生產(chǎn)運(yùn)營(yíng)的系統(tǒng)上啟動(dòng) PHP 源碼過濾器,因?yàn)檫@可能泄露系統(tǒng)機(jī)密或者嵌入的代碼中的敏感信息。

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多