Archive for 三月, 2011

Linux ./configure –prefix命令

源码的安装一般由3个步骤组成:配置(configure)、编译(make)、安装(make install),具体的安装方法一般作者都会给出文档,这里主要讨论配置(configure)。Configure是一个可执行脚本,它有很多选项,使用命令./configure –help输出详细的选项列表,如下:
-bash-3.00# ./configure –help
Usage: configure [options] [host]
Options: [defaults in brackets after descriptions]
Configuration:
–cache-file=FILE     cache test results in FILE
–help             print this message
–no-create         do not create output files
–quiet, –silent     do not print `checking…’ messages
–version           print the version of autoconf that created configure
Directory and file names:
–prefix=PREFIX       install architecture-independent files in PREFIX
[/usr/local]
–exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
[same as prefix]
–bindir=DIR         user executables in DIR [EPREFIX/bin]
……….(省略若干)
很多的选项,个人认为,你可以忽略其他的一切,但请把—prefix加上。这里以安装supersparrow-0.0.0为例,我们打算把它安装到目录 /usr/local/supersparrow,于是在supersparrow-0.0.0目录执行带选项的脚本./configure –prefix=/usr/local/supersparrow,执行成功后再编译、安装(make,make install);安装完成将自动生成目录supersparrow,而且该软件所有的文件都被复制到这个目录。为什么要指定这个安装目录?是为了以后的维护方便,如果没有用这个选项,安装过程结束后,该软件所需的软件被复制到不同的系统目录下,很难弄清楚到底复制了那些文件、都复制到哪里去了—基本上是一塌糊涂。

用了—prefix选项的另一个好处是卸载软件或移植软件。当某个安装的软件不再需要时,只须简单的删除该安装目录,就可以把软件卸载得干干净净;移植软件只需拷贝整个目录到另外一个机器即可(相同的操作系统)。


让IE也有类似firebug的功能

虽然现在的浏览器都有类似firebug的功能,但也只是类似,像我们前端用得最多的功能却没有(也可能是我还不会玩吧),举个例子:我在firebug里用得最多的功能就是修改css,然后直接在页面上看到效果,而不是修改css文件后,刷新浏览器。这个功能好像除了firebug,其他的浏览器上的开发工具都没有吧,今天无意中看到了firebug lite.让IE也可以有这样的功能。以后做页面就会轻松不少,呵。 (continue reading…)


putty远程登陆linux

方法一:使用puttygen.exe

第一步:生成密匙
运行puttygen.exe,选择需要的密匙类型和长度,使用默认的SSH2(RSA),长度设置为1024就可以了。
passphrase可以为空,免得登录时还是要输入一次密码。

点击Save private key 按钮保存公匙和私匙,例如key.ppk,public key不用保存,以后使用Puttygen.exe Load功能就可以显示public key。 (continue reading…)


Why substituteMarkerArrayCached is bad

In the previous article we talked about TYPO3 template functions. I mentioned that  substituteMarkerArrayCached is a function that developers should not use. In this article I am going to explain why.

As you remember there are four “substitute” functions for use with TYPO3 templates:

  • substituteMarker
    This function substitutes a single marker
  • substituteMarkerArray
    This function does the same as above but for many markers in the array
  • substituteSubpart
    Substitutes a single subpart
  • substituteMarkerArrayCached
    Our today’s case.

The first two functions substitute marker and marker array. The third substitutes template subpart. The obvious missing function is the one to substitute subpart array. (continue reading…)


#!/usr/bin/env python与#!/usr/bin/python的区别

这个在unix类的操作系统才有意义。
#!/usr/bin/python是告诉操作系统执行这个脚本的时候,调用/usr/bin下的python解释器;
#!/usr/bin/env python这种用法是为了防止操作系统用户没有将python装在默认的/usr/bin路径里。当系统看到这一行的时候,首先会到env设置里查找python的安装路径,再调用对应路径下的解释器程序完成操作。

 


headerComment2

typo3项目中遇到需要在baseurl之前输出内容的情况,写了一个插件实现.

用法: TS中配置

config.headerComment2 = <!– abcdefg –>

下载

1 Comment more...

Fastcgi自启动

fastcgi自启动可以在init.d里copy一份nginx改名为php-cgi, 改写关键部分后运行rcconf设置为自启动即可.

#! /bin/sh
### BEGIN INIT INFO
# Provides:          spawn-fcgi
# Required-Start:    $local_fs $remote_fs $network $syslog
# Required-Stop:     $local_fs $remote_fs $network $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts the nginx web server
# Description:       starts nginx using start-stop-daemon
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/spawn-fcgi
DAEMON_OPTS=”-a 127.0.0.1 -p 9000 -C 5 -u www-data -g www-data -f /usr/bin/php-cgi”
NAME=fastcgi
DESC=fastcgi
test -x $DAEMON || exit 0
set -e
. /lib/lsb/init-functions
test_nginx_config() {
if nginx -t $DAEMON_OPTS
then
return 0
else
return $?
fi
}
case “$1” in
start)
echo -n “Starting $DESC: “
start-stop-daemon –start –quiet –pidfile /var/run/$NAME.pid \
–exec $DAEMON — $DAEMON_OPTS || true
echo “$NAME.”
;;
stop)
echo -n “Stopping $DESC: “
pkill -9 php-cgi
echo “$NAME.”
;;
restart|force-reload)
echo -n “Restarting $DESC: “
start-stop-daemon –stop –quiet –pidfile \
/var/run/$NAME.pid –exec $DAEMON || true
sleep 1
start-stop-daemon –start –quiet –pidfile \
/var/run/$NAME.pid –exec $DAEMON — $DAEMON_OPTS || true
echo “$NAME.”
;;
reload)
echo -n “Reloading $DESC configuration: “
start-stop-daemon –stop –signal HUP –quiet –pidfile /var/run/$NAME.pid \
–exec $DAEMON || true
echo “$NAME.”
;;
configtest)
echo -n “Testing $DESC configuration: “
if test_nginx_config
then
echo “$NAME.”
else
exit $?
fi
;;
status)
status_of_proc -p /var/run/$NAME.pid “$DAEMON” nginx && exit 0 || exit $?
;;
*)
echo “Usage: $NAME {start|stop|restart|reload|force-reload|status|configtest}” >&2
exit 1
;;
esac
exit 0

#! /bin/sh
### BEGIN INIT INFO# Provides:          spawn-fcgi # Required-Start:    $local_fs $remote_fs $network $syslog# Required-Stop:     $local_fs $remote_fs $network $syslog# Default-Start:     2 3 4 5# Default-Stop:      0 1 6# Short-Description: starts the nginx web server# Description:       starts nginx using start-stop-daemon### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/binDAEMON=/usr/bin/spawn-fcgiDAEMON_OPTS=”-a 127.0.0.1 -p 9000 -C 5 -u www-data -g www-data -f /usr/bin/php-cgi”NAME=fastcgi DESC=fastcgi
test -x $DAEMON || exit 0
set -e
. /lib/lsb/init-functions
test_nginx_config() {  if nginx -t $DAEMON_OPTS  then    return 0  else    return $?  fi}
case “$1” in  start) echo -n “Starting $DESC: ” start-stop-daemon –start –quiet –pidfile /var/run/$NAME.pid \ –exec $DAEMON — $DAEMON_OPTS || true echo “$NAME.” ;;  stop) echo -n “Stopping $DESC: ”        pkill -9 php-cgi echo “$NAME.” ;;  restart|force-reload) echo -n “Restarting $DESC: ” start-stop-daemon –stop –quiet –pidfile \ /var/run/$NAME.pid –exec $DAEMON || true sleep 1 start-stop-daemon –start –quiet –pidfile \ /var/run/$NAME.pid –exec $DAEMON — $DAEMON_OPTS || true echo “$NAME.” ;;  reload)        echo -n “Reloading $DESC configuration: ”        start-stop-daemon –stop –signal HUP –quiet –pidfile /var/run/$NAME.pid \            –exec $DAEMON || true        echo “$NAME.”        ;;  configtest)        echo -n “Testing $DESC configuration: ”        if test_nginx_config        then          echo “$NAME.”        else          exit $?        fi        ;;  status) status_of_proc -p /var/run/$NAME.pid “$DAEMON” nginx && exit 0 || exit $? ;;  *) echo “Usage: $NAME {start|stop|restart|reload|force-reload|status|configtest}” >&2 exit 1 ;;esac
exit 0


[精]Linux 上配置 Nginx + PHP5 FastCGI

Nginx是俄罗斯人编写的十分轻量级的HTTP服务器,以事件驱动的方式编写,所以有非常好的性能,同时也是一个非常高效的反向代理、负载平衡。其拥有匹配Lighttpd的性能,同时还没有Lighttpd的内存泄漏问题,而且Lighttpd的mod_proxy也有一些问题并且很久没有更新。

因此我打算用其替代Apache应用于Linux服务器上。但是Nginx并不支持cgi方式运行,原因是可以减少因此带来的一些程序上的漏洞。那么我们必须使用FastCGI方式来执行PHP程序。 (continue reading…)

[精]Linux 上配置 Nginx + PHP5 FastCGI已关闭评论 more...

Copyright © 1996-2010 Add Lives. All rights reserved.
iDream theme by Templates Next | Powered by WordPress