日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 >

apache php mysql codeigniter smarty 记录方便查询

發(fā)布時間:2023/11/29 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 apache php mysql codeigniter smarty 记录方便查询 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

windows:apache?

  • apache:關(guān)于apache狀態(tài)
  • <Location /server-status>SetHandler server-statusOrder deny,allowDeny from allAllow from 127.0.0.1 </Location>

       restart apache;

    ?

      2.apache:關(guān)閉自動目錄列表

    #Options Indexes FollowSymLinks#更換為Options -Indexes

       restart apache;  

    ?

      3.apache:vhosts

        a,開啟vhosts

    # Virtual hosts Include conf/extra/httpd-vhosts.conf

    ? ? ? ? ? ?b,打開 a中的httpd-vhosts.conf文件添加配置

          使用vhosts時,需將httpd.conf中的目錄設(shè)置好你所有的vhosts站點(diǎn)的父目錄,否則是無效的;

          如:d:/www/web/vhost1

            d:/www/web/vhost2

            ................

            d:/www/web/vhost10

            則你的httpd.conf?Directory 應(yīng)該是?d:/www/web/

    ?

    # # Use name-based virtual hosting. # #以下為你所要監(jiān)控的IP列表 #注意喜歡監(jiān)控域名的同學(xué)在使用CDN的使用你一定要換成監(jiān)控IP,要不然你懂的 NameVirtualHost XXX.XXX.XX.XX:80 NameVirtualHost X.X.X.X.X:80 <VirtualHost XXX.XXX.XXX.XXX:80>ServerAdmin youmailDocumentRoot "you dir"ServerName you domainErrorLog "you log"CustomLog "you log" common#Redirect permanent / http://轉(zhuǎn)發(fā)domain/ </VirtualHost>

    當(dāng)在所有的vhost中找不到相關(guān)的配置記錄時,默認(rèn)返回的是第一個vhost配置。所以要注意這里。

    ?

    更好的方式: virtue hosts map文件方式,自動生成虛擬站點(diǎn)記錄,可以使用腳本(php、jsp或其它)自動生成記錄寫入文件,即時生效無需重啟

    ? ? ? ? ? ? c, restart apache;

    ?

      4,apache:并發(fā)調(diào)整

        a,開啟mpm

    # Server-pool management (MPM specific) #開啟mpm Include conf/extra/httpd-mpm.conf

        b,打開 a 中的 httpd-mpm.conf

          windows平臺直接找到最后面的 WinNT MPM,以下說明內(nèi)容來自apache手冊

    Apache MPM winnt

    說明狀態(tài)模塊名源文件
    專門為Windows NT優(yōu)化過的MPM
    MPM
    mpm_winnt_module
    mpm_winnt.c

    ?

    ?

    ?

    概述

    該多路處理模塊(MPM)是Windows NT上的默認(rèn)值。它使用一個單獨(dú)的父進(jìn)程產(chǎn)生一個單獨(dú)的子進(jìn)程,在這個子進(jìn)程中輪流產(chǎn)生多個線程來處理請求。

    我們需要調(diào)整以下的內(nèi)容,詳細(xì)介紹看下面的來自手冊的內(nèi)容

    # WinNT MPM # ThreadsPerChild: constant number of worker threads in the server process # MaxRequestsPerChild: maximum number of requests a server process serves <IfModule mpm_winnt_module>ThreadsPerChild 2000MaxRequestsPerChild 10000 </IfModule>

    注意:根據(jù)你機(jī)器的情況調(diào)上面的值。但是windows平臺下天生有問題好像,ThreadsPerChild不可設(shè)置的過高,就像你機(jī)器再好也不要。

    求大牛解答,感謝。感謝。

    ?

    ThreadsPerChild 指令

    說明語法默認(rèn)值作用域狀態(tài)模塊
    每個子進(jìn)程建立的線程數(shù)
    ThreadsPerChild number
    參見下面的說明
    server config
    MPM
    mpm_winnt, worker

    ?

    ?

    ?

    ?

    ?

    這個指令設(shè)置了每個子進(jìn)程建立的線程數(shù)。子進(jìn)程在啟動時建立這些線程后就不再建立新的線程了。如果使用一個類似于mpm_winnt只有一個子進(jìn)程的MPM,這個數(shù)值要足夠大,以便可以處理可能的請求高峰。如果使用一個類似于worker有多個子進(jìn)程的MPM,每個子進(jìn)程所擁有的所有線程的總數(shù)要足夠大,以便可以處理可能的請求高峰。

    對于mpm_winnt,ThreadsPerChild的默認(rèn)值是64;對于其他MPM是25。

    ?

    MaxRequestsPerChild 指令

    說明語法默認(rèn)值作用域狀態(tài)模塊
    每個子進(jìn)程在其生存期內(nèi)允許伺服的最大請求數(shù)量
    MaxRequestsPerChild number
    MaxRequestsPerChild 10000
    server config
    MPM
    mpm_netware, mpm_winnt, mpmt_os2, prefork, worker

    ?

    ?

    ?

    ?

    ?

    MaxRequestsPerChild指令設(shè)置每個子進(jìn)程在其生存期內(nèi)允許伺服的最大請求數(shù)量。到達(dá)MaxRequestsPerChild的限制后,子進(jìn)程將會結(jié)束。如果MaxRequestsPerChild為"0",子進(jìn)程將永遠(yuǎn)不會結(jié)束。

    不同的默認(rèn)值

    在mpm_netware和mpm_winnt上的默認(rèn)值是"0"。

    將MaxRequestsPerChild設(shè)置成非零值有兩個好處:

    • 可以防止(偶然的)內(nèi)存泄漏無限進(jìn)行,從而耗盡內(nèi)存。
    • 給進(jìn)程一個有限壽命,從而有助于當(dāng)服務(wù)器負(fù)載減輕的時候減少活動進(jìn)程的數(shù)量。

    注意

    對于KeepAlive鏈接,只有第一個請求會被計數(shù)。事實上,它改變了每個子進(jìn)程限制最大鏈接數(shù)量的行為。

    ?

    php mysql mssql?codeigniter smarty

      1,php:sockets

        我主要與C++通訊,并且通訊的數(shù)據(jù)包是C++中的結(jié)構(gòu)體。所以采用php pack。

        參與以下文章,順便感謝:http://www.neatstudio.com/show-2327-1.shtml

      3,php:mysql

        這個沒什么好說的。我使用的是codeigniter框架。codeigniter有自己的db class ,有詳細(xì)的手冊。

      3,php:mssql

        同樣,codeigniter有自己的db class,有詳細(xì)的手冊。

        我的環(huán)境環(huán)境是 mssql 2008,采用odbc方式。

        如下文所例:http://www.taomy.net/codeigniter-%E9%80%9A%E8%BF%87odbc%E8%BF%9E%E6%8E%A5-sqlserver%E7%9A%84%E6%96%B9%E6%B3%95%E5%AE%9E%E4%BE%8B

        需要注意的是,如果使用ci的?Active Record 數(shù)據(jù)庫模式 getwhere mssql數(shù)據(jù)時,其所生成的sql語句是不附合mssql2008的語法的。需要自己解決。

      4,php:codeigniter?

        在臨時接手這個項目的時候找了很多的框架,最終相中codeigniter,如其官方宣傳一樣 小巧,易學(xué),輕量,性能不錯,等非常易上手,以至于我臨時啃PHP手冊和codeigniter手冊就能應(yīng)付來的了。

        http://codeigniter.org.cn/

        http://codeigniter.org.cn/user_guide/index.html

        新浪sae有codeigniter sae上架,,還蠻方便的,寫代碼學(xué)習(xí)什么的,可以嘗試下

        http://sae.sina.com.cn/?m=myapp&a=chooseapp

      5,php:codeigniter:smarty

         smarty真是好東西。不過現(xiàn)在類似的模板引擎非常多,不過最終還是相中smarty。codeigniter整合smarty也蠻簡單使用起來也很方便。

         http://www.smarty.net/

         在 http://codeigniter.org.cn/forums/forum.php?搜索也會有一堆的結(jié)果。

    我的配置方式如下:

    ?

    1,將 Smarty 文件中的 lib 文件夾 ??拷貝至?CodeIgniterh目錄 application\libraries 文件夾下 并重命名smarty lib文件名? 2,在application\libraries目錄中新建文件:,并拷貝如下內(nèi)容 <?php if(!defined('BASEPATH'))exit('no dir'); require_once (APPPATH.'libraries/Cismarty/Smarty.class.php');class Cismarty extends Smarty {protected $ci;function __construct(){parent::__construct();$this->ci = &get_instance();$this->template_dir = $this->ci->config->item('template_dir');$this->compile_dir = $this->ci->config->item('compile_dir');$this->cache_dir = $this->ci->config->item('caching_dir');$this->config_dir = $this->ci->config->item('config_dir');//$this->template_ext = $this->ci->config->item('template_ext');$this->caching = $this->ci->config->item('caching');$this->cache_lifetime = $this->ci->config->item('cache_lifetime');$this->left_delimiter = $this->ci->config->item('left_delimiter');$this->right_delimiter = $this->ci->config->item('right_delimiter');}} ?>

    ?

    3,在application\config目錄中新建,并拷貝如下內(nèi)容作為配置文件 <?php if (! defined('BASEPATH')) exit('no direct base'); // $config['template_dir'] = APPPATH.'views'; // $config['compile_dir'] = FCPATH.'template_c'; // $config['caching_dir'] = FCPATH.'cache'; // $config['config_dir'] = FCPATH.'config';$config['template_dir'] = APPPATH.'views/templates';$config['compile_dir'] = APPPATH.'views/template_c';$config['caching_dir'] = FCPATH.'cache';$config['config_dir'] = FCPATH.'config';$config['caching'] = false; //是否開啟緩存$config['cache_lifetime'] = '60'; //緩存生存時間(秒)//$config['template_ext'] = '.html';$config['left_delimiter'] = '{!~';$config['right_delimiter'] = '~!}';?>

    ?

    4,打開application\config文件,設(shè)置自動加載smarty配置文件和加載smarty插件,增加或修改如下內(nèi)容 $autoload['config'] = array('smarty'); //自動加載配置文件 $autoload['libraries'] = array('cismarty'); //自動每一頁加載smarty模板

    ?

    ps.如果不自動加載時可以在需要使用的頁面中調(diào)用?$this->load->library('cismarty');進(jìn)行加載 5,測試程序 a,在application\controllers目錄中新建立控制器??內(nèi)容如下:

    ? ? ? ?

    <?php class Test extends CI_Controller {function __construct(){parent::__construct();//$this->load->library("cismarty");$this->load->library('form_validation');$this->form_validation->set_error_delimiters('<p class="error">', '</p>');}public function index(){$this->cismarty->assign("Name","test name");$this->cismarty->display( 'test.html' );} } ?>

    ?

    b,在application\views\templates模板目錄中新建模板文件內(nèi)容如下: {!~$Name~!} c,輸入 http://localhost/you項目部/index.php/test ?測試效果

    ?

    轉(zhuǎn)載于:https://www.cnblogs.com/ah2710/archive/2013/05/28/3103332.html

    總結(jié)

    以上是生活随笔為你收集整理的apache php mysql codeigniter smarty 记录方便查询的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。