Spawn PHP5/4 fastcgi on mac osx

下面是我使用的脚本,用于启动php5/4的fastcgi daemon,和linux 上使用的版本基本一样:


#!/bin/bash
#PID for SPAWN Process
PID=/tmp/php5-fcgi.pid
## ABSOLUTE path to the spawn-fcgi binary
SPAWNFCGI="/usr/local/bin/spawn-fcgi"

## ABSOLUTE path to the PHP binary
FCGIPROGRAM="/usr/local/php5/bin/php5"
#FCGIPROGRAM="/usr/local/bin/php"

## TCP port to which to bind on localhost
FCGIPORT="1026"
FCGISOCKET=/tmp/php5.socket
## number of PHP children to spawn
PHP_FCGI_CHILDREN=2

## maximum number of requests a single PHP process can serve before it is restarted
PHP_FCGI_MAX_REQUESTS=1000

## IP addresses from which PHP should access server connections
FCGI_WEB_SERVER_ADDRS="127.0.0.1,192.168.2.10,192.168.80.108"

# php.ini
PHPRC=/usr/local/php5/etc/php.ini

# allowed environment variables, separated by spaces
ALLOWED_ENV="ORACLE_HOME PATH USER"

## if this script is run as root, switch to the following user
USERID=www
GROUPID=www

ICE_HOME=/opt/Ice-3.2.0
export ICE_HOME
export DYLD_LIBRARY_PATH=$ICE_HOME/lib:$DYLD_LIBRARY_PATH
################## no config below this line

if test x$PHP_FCGI_CHILDREN = x; then
  PHP_FCGI_CHILDREN=5
fi

export PHP_FCGI_MAX_REQUESTS
export FCGI_WEB_SERVER_ADDRS
export PHPRC

ALLOWED_ENV="$ALLOWED_ENV PHP_FCGI_MAX_REQUESTS FCGI_WEB_SERVER_ADDRS PHPRC ICE_HOME DYLD_LIBRARY_PATH"

if test x$UID = x0; then
  if test x$FCGISOCKET = x; then
  EX="$SPAWNFCGI -p $FCGIPORT -f $FCGIPROGRAM -u $USERID -g $GROUPID -C $PHP_FCGI_CHILDREN -P $PID"
  else
  EX="$SPAWNFCGI -s $FCGISOCKET -f $FCGIPROGRAM -u $USERID -g $GROUPID -C $PHP_FCGI_CHILDREN -P $PID "
  fi
else
  if test x$FCGISOCKET = x; then
  EX="$SPAWNFCGI -p $FCGIPORT -f $FCGIPROGRAM -C $PHP_FCGI_CHILDREN -P $PID "
  else
  EX="$SPAWNFCGI  -s $FCGISOCKET -f $FCGIPROGRAM -C $PHP_FCGI_CHILDREN -P $PID"
  fi
fi

# copy the allowed environment variables
E=

for i in $ALLOWED_ENV; do
  E="$E $i=${!i}"
done

# clean the environment and set up a new one
start(){
    if [ -f $PID ];then
        echo "PHP is running already.";
        exit 1;
    fi
   env - $E $EX
}
stop(){
    if test -f $PID;then
        killall `basename $FCGIPROGRAM`
        rm -f $PID
    else
        echo "PHP is not running"
    fi
}

#Main################
case "$1" in
    'start')
    start
    ;;
    'stop')
    stop
    ;;
    'restart')
    stop
    start
    ;;
    *)
    echo "usage: $0 {start|stop|restart}"
    ;;
esac
exit 1

Icc 9 compile script for PHP5.2.3 on x86_64

默认的php脚本是无法在x86_64上面编译的。
此脚本适用于php5.2.x.

flags="-cxxlib-icc -i-static -unroll2 -O3 -no-prec-div -xP " \
CC=icc \
CXX=icpc \
CFLAGS="$flags" \
CXXFLAGS="$flags" \
./configure \
--prefix=/usr/local/php5  \
--with-libdir=lib64 \
--enable-force-cgi-redirect \
--enable-fastcgi \
--enable-ftp \
--enable-calendar \
--enable-gd-native-ttf \
--enable-mbstring \
--enable-mbstr-enc-trans \
--enable-mbregex \
--enable-shmod \
--enable-sockets \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-inline-optimization \
--disable-ipv6 \
--disable-debug \
--with-config-file-path=/usr/local/php5/etc \
--with-config-file-scan-dir=/usr/local/php5/etc/php.d \
--with-zlib \
--with-curl \
--with-dom \
--with-dom-xslt \
--with-gd=/usr \
--enable-gd-native-ttf \
--with-jpeg-dir=/usr \
--with-png-dir=/usr \
--with-gettext \
--with-openssl=shared \
--with-mysql \
--with-freetype-dir=/usr \
--with-mysqli \
--with-iconv  \
--with-gettext \
--with-xml \
--with-kerberos \
--with-pcre-regex \
--with-mime-magic=/usr/share/file/magic.mime
make clean
make

关于UE的几个站点

http://ucdchina.com/blog/

http://blog.rexsong.com/

http://ucdchina.com/angela/

http://www.moond.com/lab/

SCPlugin-Mac下的TortoiseSVN

###[SCPlugin](http://scplugin.tigris.org/)###

以前在windows下面一般用TortoiseSVN,或者是在eclipse/zde里面用。在linux下面则用命令行。现在我的工作用机是mac,一般也使用命令行。因为我还是习惯用终端工作,在vim中由于有一个vs的plugin,也没有想过用什么gui。不过,命令行的缺点是你无法一目了然的看到文件的状态。这点是当初用TortoiseSVN的最大便捷之处。好在发现了SCPlugin,这是一个Finder的plugin,和TSVN基本上是一样的。

powered by performancing firefox

ICC编译ImageMagic的小问题

本来也没什么,不过在编译source rpm中最后link libwmf的时候总说M64非法,无法编译为shared方式。rpm -qa一下,发现,libwmf
有2个x32和x64,但是devel是x32的。估计问题在这里,删除x32的libwmf rpm,ok。
自己写的一个sh,方便用icc build rpm包:


flags="-O3 -ipo -cxxlib-icc -i-static -mp -unroll2 -axT" \
CC=icc \
CXX=icpc \
CFLAGS="$flags" \
CXXFLAGS="$flags" \
CPPFLAGS="$flags" \
LD=xild \
AR=xiar \
LDFLAGS="-cxxlib-icc -i-static" \
CXXLDFLAGS="-cxxlib-icc -i-static" \
rpmbuild -ba "$*"

针对,intel duo-core 处理器的

« Previous Page