Oct21

Apache HTTP 2.4安装小记

Author: leeon  Click: 581   Comments: 0 Category: 其他  Tag: httpd,2.4

最新版本2.4的httpd已经不在内置apr和apr-util了,但是在configure --help中却还能看到:

[root@rh-1 httpd-2.4.3]# ./configure --help | grep apr
  --with-included-apr     Use bundled copies of APR/APR-Util
  --with-apr=PATH         prefix for installed APR or the full path to
                             apr-config
  --with-apr-util=PATH    prefix for installed APU or the full path to

以前版本都能使用with-included-apr来安装,现在的新版本查看安装手册后发现比以前麻烦了许多,需要自行提前安装准备pcre库和apr库

 

The following requirements exist for building Apache httpd:

APR and APR-Util
Make sure you have APR and APR-Util already installed on your system. If you don't, or prefer to not use the system-provided versions, download the latest versions of both APR and APR-Util from Apache APR, unpack them into ./srclib/apr and ./srclib/apr-util (be sure the domain names do not have version numbers; for example, the APR distribution must be under ./srclib/apr/) and use ./configure's --with-included-aproption. On some platforms, you may have to install the corresponding -dev packages to allow httpd to build against your installed copy of APR and APR-Util.
Perl-Compatible Regular Expressions Library (PCRE)
This library is required but not longer bundled with httpd. Download the source code from http://www.pcre.org, or install a Port or Package. If your build system can't find the pcre-config script installed by the PCRE build, point to it using the --with-pcre parameter. On some platforms, you may have to install the corresponding -dev package to allow httpd to build against your installed copy of PCRE.
Disk Space
Make sure you have at least 50 MB of temporary free disk space available. After installation the server occupies approximately 10 MB of disk space. The actual disk space requirements will vary considerably based on your chosen configuration options, any third-party modules, and, of course, the size of the web site or sites that you have on the server.
ANSI-C Compiler and Build System
Make sure you have an ANSI-C compiler installed. The GNU C compiler (GCC) from the Free Software Foundation (FSF) is recommended. If you don't have GCC then at least make sure your vendor's compiler is ANSI compliant. In addition, your PATH must contain basic build tools such asmake.
Accurate time keeping
Elements of the HTTP protocol are expressed as the time of day. So, it's time to investigate setting some time synchronization facility on your system. Usually the ntpdate or xntpd programs are used for this purpose which are based on the Network Time Protocol (NTP). See the NTP homepage for more details about NTP software and public time servers.
Perl 5 [OPTIONAL]
For some of the support scripts like apxs or dbmmanage (which are written in Perl) the Perl 5 interpreter is required (versions 5.003 or newer are sufficient). If you have multiple Perl interpreters (for example, a systemwide install of Perl 4, and your own install of Perl 5), you are advised to use the --with-perl option (see below) to make sure the correct one is used by configure. If no Perl 5 interpreter is found by the configure script, you will not be able to use the affected support scripts. Of course, you will still be able to build and use Apache httpd.
Jul21

array_map,array_filter,array_walk区别小记

Author: leeon  Click: 10142   Comments: 0 Category: php  Tag: array_map,array_filter,array_walk,php,trim

array_walk:

array_walk()返回布尔值,如果回调函数需要直接作用于数组中的值,则给回调函数的第一个参数指定为引用。这样任何对这些单元的改变也将会改变原始数组本身。此函数可以同时获取到数组的key和value。

array_map:

array_map() 返回一个数组,该数组包含了 arr1 中的所有单元经过 callback 作用过之后的单元。callback 接受的参数数目应该和传递给 array_map() 函数的数组数目一致。

简单点说就是回调函数对数组中每个值都会产生最终影响,并在调用array_map的返回值中体现。

此函数可以同时对多个数组进行操作。并最终合并为一个数组(每个数组根据下标平行对其到同一个二维数组中)。


array_filter:

此函数是专门用于过去数组中的元素,简单点说就是对数组中的经过回调函数判断的value进行过滤,并通过array_filter()函数返回处理后的数组。


因此分析到此我们可以是哟on个array_walk和array_map来做数组的预处理,最常见的是对每个数组值的trim操作。以下是笔者的示例代码:

[code="php"]
<?php
$tmp = array(' AAAA BBBB CCCC ', 'aaaa bbbb c ', ' dddddd eeeeee');

function array_walk_func(&$v, $k) {
$v = trim($v);
}
array_walk($tmp, 'array_walk_func');
var_dump($tmp);

function array_map_func($v) {
return trim($v);
}
$ret = array_map('array_map_func', $tmp);
var_dump($ret);
[/code]

输出结果:

[code="php"]
array(3) {
[0] =>
string(14) "AAAA BBBB CCCC"
[1] =>
string(11) "aaaa bbbb c"
[2] =>
string(13) "dddddd eeeeee"
}
array(3) {
[0] =>
string(14) "AAAA BBBB CCCC"
[1] =>
string(11) "aaaa bbbb c"
[2] =>
string(13) "dddddd eeeeee"
}

[/code]

May29

【原创】CodeMirror中使用shell库ie不兼容解决方案

Author: leeon  Click: 10763   Comments: 1 Category: javascript  Tag: javascript,codemirror,array,indexof

最近需要在项目中使用在线HTML编辑器编辑shell脚本,找了几个开源的js库发现codemirror非常轻量级且好用,最近的版本中已经加入了shell的支持,并且支持绝大多数主流的编程语言。但是在ie下调用codemirror提供的shell.js脚本库的时候无法正常使用,调试bug发现都卡在atoms.indexOf这个方法上。

[code="js"]
if (stream.peek() === '=' && /\w+/.test(cur)) return 'def';
if (atoms.indexOf(cur) !== -1) return 'atom';
if (commands.indexOf(cur) !== -1) return 'builtin';
if (keywords.indexOf(cur) !== -1) return 'keyword';
[/code]

搜索了下发现是ie下对数组不能直接使用indexof方法,于是借鉴此文:

http://blog.csdn.net/x123jing/article/details/7064312

的方法在代码头部加上了:

[code="js"]
if(!Array.indexOf)
{
Array.prototype.indexOf = function(obj)
{
for(var i=0; i<this.length; i++)
{
if(this[i]==obj)
{
return i;
}
}
return -1;
}
}
[/code]

于是问题解决,ie,ff,chrome都能正常使用了!

May24

【原创】Linux中find命令mtime参数值的讲解

Author: leeon  Click: 10289   Comments: 1 Category: linux  Tag: find,linux,mtime

大家在使用find命令中的mtime参数时候,会看到官方的解释如下:

 -mtime n
              File's data was last modified n*24 hours ago.  See the comments for -atime to understand how rounding affects  the
              interpretation of file modification times.

但是在各种参考的使用方式中有用+号,-号,不带符号的用法,那么这里又有什么区别呢?

注意这里的n,如果n为带有+号的值,意思为删除n天前所有的文件,比如n=+1且今天是15号,那么删除14号以前的数据,不包括14号,如果是负号(n=-1)则为删除一天内的文件,比如今天15号,那么删除15号的数据,如果是(n=-2)则代表删除一天前到今天的所有数据,比如今天15号,那么从14号开始删除。如果不带有符号,那么则删除指定前n天中这一天的数据,比如(n=1)且今天是15号,则删除14号这一天所有数据。

注意这里的一天是指当前系统时间算起的,而不是0-24小时算一天

分类

标签

归档

最新评论

Abyss在00:04:28评论了
Linux中ramdisk,tmpfs,ramfs的介绍与性能测试
shallwe99在10:21:17评论了
【原创】如何在微信小程序开发中正确的使用vant ui组件
默一在09:04:53评论了
Berkeley DB 由浅入深【转自架构师杨建】
Memory在14:09:22评论了
【原创】最佳PHP框架选择(phalcon,yaf,laravel,thinkphp,yii)
leo在17:57:04评论了
shell中使用while循环ssh的注意事项

我看过的书

链接

其他

访问本站种子 本站平均热度:8823 c° 本站链接数:1 个 本站标签数:464 个 本站被评论次数:94 次