apache php mysql codeigniter smarty 记录方便查询
windows:apache[*]apache:关于apache状态
SetHandler server-status
Order deny,allow
Deny from all
Allow from 127.0.0.1
restart apache;
2.apache:关闭自动目录列表
#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中的目录设置好你所有的vhosts站点的父目录,否则是无效的;
如:d:/www/web/vhost1
d:/www/web/vhost2
................
d:/www/web/vhost10
则你的httpd.conf Directory 应该是 d:/www/web/
#
# Use name-based virtual hosting.
#
#以下为你所要监控的IP列表
#注意喜欢监控域名的同学在使用CDN的使用你一定要换成监控IP,要不然你懂的
NameVirtualHost XXX.XXX.XX.XX:80
NameVirtualHost X.X.X.X.X:80
ServerAdmin youmail
DocumentRoot "you dir"
ServerName you domain
ErrorLog "you log"
CustomLog "you log" common
#Redirect permanent / http://转发domain/
当在所有的vhost中找不到相关的配置记录时,默认返回的是第一个vhost配置。所以要注意这里。
更好的方式:
virtue hosts map文件方式,自动生成虚拟站点记录,可以使用脚本(php、jsp或其它)自动生成记录写入文件,即时生效无需重启
c, restart apache;
4,apache:并发调整
a,开启mpm
# Server-pool management (MPM specific)
#开启mpm
Include conf/extra/httpd-mpm.conf
b,打开 a 中的 httpd-mpm.conf
windows平台直接找到最后面的 WinNT MPM,以下说明内容来自apache手册
Apache MPM winnt
说明
专门为Windows NT优化过的MPM
状态
MPM
模块名
mpm_winnt_module
源文件
mpm_winnt.c
概述
该多路处理模块(MPM)是Windows NT上的默认值。它使用一个单独的父进程产生一个单独的子进程,在这个子进程中轮流产生多个线程来处理请求。
我们需要调整以下的内容,详细介绍看下面的来自手册的内容
# WinNT MPM
# ThreadsPerChild: constant number of worker threads in the server process
# MaxRequestsPerChild: maximumnumber of requests a server process serves
ThreadsPerChild 2000
MaxRequestsPerChild 10000
注意:根据你机器的情况调上面的值。但是windows平台下天生有问题好像,ThreadsPerChild不可设置的过高,就像你机器再好也不要。
求大牛解答,感谢。感谢。
ThreadsPerChild 指令
说明
每个子进程建立的线程数
语法
ThreadsPerChild number
默认值
参见下面的说明
作用域
server config
状态
MPM
模块
mpm_winnt, worker
这个指令设置了每个子进程建立的线程数。子进程在启动时建立这些线程后就不再建立新的线程了。如果使用一个类似于mpm_winnt只有一个子进程的MPM,这个数值要足够大,以便可以处理可能的请求高峰。如果使用一个类似于worker有多个子进程的MPM,每个子进程所拥有的所有线程的总数要足够大,以便可以处理可能的请求高峰。
对于mpm_winnt,ThreadsPerChild的默认值是64;对于其他MPM是25。
MaxRequestsPerChild 指令
说明
每个子进程在其生存期内允许伺服的最大请求数量
语法
MaxRequestsPerChild number
默认值
MaxRequestsPerChild 10000
作用域
server config
状态
MPM
模块
mpm_netware, mpm_winnt, mpmt_os2, prefork, worker
MaxRequestsPerChild指令设置每个子进程在其生存期内允许伺服的最大请求数量。到达MaxRequestsPerChild的限制后,子进程将会结束。如果MaxRequestsPerChild为"0",子进程将永远不会结束。
不同的默认值
在mpm_netware和mpm_winnt上的默认值是"0"。
将MaxRequestsPerChild设置成非零值有两个好处:
[*]可以防止(偶然的)内存泄漏无限进行,从而耗尽内存。
[*]给进程一个有限寿命,从而有助于当服务器负载减轻的时候减少活动进程的数量。
注意
对于KeepAlive链接,只有第一个请求会被计数。事实上,它改变了每个子进程限制最大链接数量的行为。
php mysql mssql codeigniter smarty
1,php:sockets
我主要与C++通讯,并且通讯的数据包是C++中的结构体。所以采用php pack。
参与以下文章,顺便感谢:http://www.neatstudio.com/show-2327-1.shtml
3,php:mysql
这个没什么好说的。我使用的是codeigniter框架。codeigniter有自己的db class ,有详细的手册。
3,php:mssql
同样,codeigniter有自己的db class,有详细的手册。
我的环境环境是 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 数据库模式 getwhere mssql数据时,其所生成的sql语句是不附合mssql2008的语法的。需要自己解决。
4,php:codeigniter
在临时接手这个项目的时候找了很多的框架,最终相中codeigniter,如其官方宣传一样 小巧,易学,轻量,性能不错,等非常易上手,以至于我临时啃PHP手册和codeigniter手册就能应付来的了。
http://codeigniter.org.cn/
http://codeigniter.org.cn/user_guide/index.html
新浪sae有codeigniter sae上架,,还蛮方便的,写代码学习什么的,可以尝试下
http://sae.sina.com.cn/?m=myapp&a=chooseapp
5,php:codeigniter:smarty
smarty真是好东西。不过现在类似的模板引擎非常多,不过最终还是相中smarty。codeigniter整合smarty也蛮简单使用起来也很方便。
http://www.smarty.net/
在 http://codeigniter.org.cn/forums/forum.php 搜索也会有一堆的结果。
我的配置方式如下:
1,将 Smarty 文件中的 lib 文件夹http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/Users/Administrator/AppData/Local/youdao/ynote/images/4968C429D2484A9AAE1AAC5CD2B4CF29/clipboard.png 拷贝至 CodeIgniterh目录 application\libraries 文件夹下 并重命名smarty lib文件名 http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/Users/Administrator/AppData/Local/youdao/ynote/images/F29AE6B76DE540F68B553A2897B52F69/clipboard.png
2,在application\libraries目录中新建文件:http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/Users/Administrator/AppData/Local/youdao/ynote/images/75B09AC922BA4A19BB89C101B1B89DA0/clipboard.png,并拷贝如下内容
3,在application\config目录中新建http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/Users/Administrator/AppData/Local/youdao/ynote/images/7CF062E449B64EFF84E54E5DFBEF9582/clipboard.png,并拷贝如下内容作为配置文件
4,打开application\confighttp://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/Users/Administrator/AppData/Local/youdao/ynote/images/72326D1625FD460D9D3DA160229FE791/clipboard.png文件,设置自动加载smarty配置文件和加载smarty插件,增加或修改如下内容
$autoload['config'] = array('smarty'); //自动加载配置文件
$autoload['libraries'] = array('cismarty'); //自动每一页加载smarty模板
ps.如果不自动加载时可以在需要使用的页面中调用 $this->load->library('cismarty');进行加载
5,测试程序
a,在application\controllers目录中新建立控制器 http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/Users/Administrator/AppData/Local/youdao/ynote/images/B1904ABB873B4F539283C01346858FF0/clipboard.png 内容如下:
b,在application\views\templates模板目录中新建模板文件http://onexin.iyunv.com/source/plugin/onexin_bigdata/file:///C:/Users/Administrator/AppData/Local/youdao/ynote/images/40CCADCF9ADF4C52999C089B936694DA/clipboard.png内容如下:
{!~$Name~!}
c,输入 http://localhost/you项目部/index.php/test测试效果
页:
[1]