只需一步:
$FN_-2147483647( );改为parent::__construct();
只需一步:
$FN_-2147483647( );改为parent::__construct();
1、打开apache配置文档或虚拟主机配置文档
2、修改open_basedir([...])为open_base_dir()。就是中间加了个下划线。
本文译自 http://nvie.com/posts/a-successful-git-branching-model (by Vincent Driessen)
本文中我会展示一种开发模型,一年前该模型就已经被我用在所有的项目中(包括工作中的项目和私有项目),结果是非常成功的。我早就想为此写点东西,可直到现在才有时间。本文不会讲述任何项目的细节,只会涉及到分支策略和发布管理。
在做Ruby on rail开发环境的时候,发现ruby有了yaml库需求,如果不进行前置安装yaml库,那么在进行接下来的rubygems和rails的时候就会出现如下错误:
“It seems your ruby installation is missing psych (for YAML output). To eliminate this warning, please install libyaml and reinstall your ruby.”
注意:请勿使用yum去更新libyaml-devel和libyaml
|
1 2 3 4 5 |
wget -c http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
tar xzvf yaml-0.1.4.tar.gz
cd yaml-0.1.4
./configure --prefix=/usr/local #注意此处勿改路径!否则库文件无法写入正确目录
make && make install |
|
1 2 3 4 5 |
wget -c http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz
tar zvxf ruby-1.9.3-p125.tar.gz
cd ruby-1.9.3-p125
./configure --prefix=/usr/local --enable-shared --disable-install-doc --with-opt-dir=/usr/local/lib
make && install |
在ruby的源码目录执行
|
1 |
make clean |
然后回到Step 1的yaml库安装步骤开始。
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
/**
* @name 名字
* @abstract 申明变量/类/方法
* @access 指明这个变量、类、函数/方法的存取权限
* @author 函数作者的名字和邮箱地址
* @category 组织packages
* @copyright 指明版权信息
* @const 指明常量
* @deprecate 指明不推荐或者是废弃的信息
* @example 示例
* @exclude 指明当前的注释将不进行分析,不出现在文挡中
* @final 指明这是一个最终的类、方法、属性,禁止派生、修改。
* @global 指明在此函数中引用的全局变量
* @include 指明包含的文件的信息
* @link 定义在线连接
* @module 定义归属的模块信息
* @modulegroup 定义归属的模块组
* @package 定义归属的包的信息
* @param 定义函数或者方法的参数信息
* @return 定义函数或者方法的返回信息
* @see 定义需要参考的函数、变量,并加入相应的超级连接。
* @since 指明该api函数或者方法是从哪个版本开始引入的
* @static 指明变量、类、函数是静态的。
* @throws 指明此函数可能抛出的错误异常,极其发生的情况
* @todo 指明应该改进或没有实现的地方
* @var 定义说明变量/属性。
* @version 定义版本信息
*/ |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
#!/bin/sh
export PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin
if [ $(id -u) != "0" ]; then
quit "You must be root to run this script!"
fi
echo "=================download source files,wait================="
echo " @Author:xiehai / qq:50083000 "
echo "============================================================"
sleep 2
yum install -y gcc gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel
/usr/sbin/groupadd www
/usr/sbin/useradd -g www www -s /sbin/nologin
wget -c http://nginx.org/download/nginx-1.0.14.tar.gz
tar zxf nginx-1.0.14.tar.gz
cd nginx-1.0.14
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
make && make install
cd ..
rm -rf nginx-1.0.14
if [ -s jdk-6u31-linux-i586-rpm.bin ]; then
echo "jdk-6u31-linux-i586-rpm.bin [found]"
else
echo "Error: jdk-6u31-linux-i586-rpm.bin not found!!!download now......"
wget -c http://download.oracle.com/otn-pub/java/jdk/6u31-b04/jdk-6u31-linux-i586-rpm.bin
fi
if [ -s apache-tomcat-7.0.26.tar.gz ]; then
echo "apache-tomcat-7.0.26.tar.gz [found]"
else
echo "Error: apache-tomcat-7.0.26.tar.gz not found!!!download now......"
wget -c http://apache.etoak.com/tomcat/tomcat-7/v7.0.26/bin/apache-tomcat-7.0.26.tar.gz
fi
cp jdk-6u31-linux-i586-rpm.bin /usr/jdk-6u31-linux-i586-rpm.bin
cp apache-tomcat-7.0.26.tar.gz /usr/local/apache-tomcat-7.0.26.tar.gz
sleep 2
cd /usr
chmod +x jdk-6u31-linux-i586-rpm.bin
./jdk-6u31-linux-i586-rpm.bin
rm -f jdk-6u31-linux-i586-rpm.bin
cd /usr/local
tar zvxf apache-tomcat-7.0.26.tar.gz
mv apache-tomcat-7.0.26 tomcat
rm -f zvxf apache-tomcat-7.0.26.tar.gz
cat >>/etc/profile<<EOF
JAVA_HOME=/usr/java/jdk1.6.0_31
PATH=$PATH:$JAVA_HOME/bin
CLASSPATH=.:$JAVA_HOME/jre/lib:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar
export JAVA_HOME
export PATH
export CLASSPATH
export TOMCAT_HOME=/usr/local/tomcat
export CATALINA_HOME=/usr/local/tomcat
export PATH=$PATH:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:$JAVA_HOME/bin
export PATH=$PATH:/usr/local/nginx/sbin/nginx
EOF
source /etc/profile
sed -i 's/8080/80/g' /usr/local/tomcat/conf/server.xml
cd /etc/init.d
wget http://thor.hiceon.com/tomcat
chmod 755 tomcat
chkconfig --add tomcat
chkconfig --level 2345 tomcat on
/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
/sbin/iptables -I INPUT -p tcp --dport 443 -j ACCEPT
/etc/rc.d/init.d/iptables save
echo "================TOMCAT START================="
service tomcat start
echo "================JAVA VERSION================="
java -version
echo "================CONGRATULATIONS!!TOMCAT IS INSTALLED ON YOUR SYSTEM=================" |
先说说IIS 7,刚刚友人问我IIS7下的Codeigniter的重写去掉index.php应该怎么做,在IIS7之前的时代,用ISAPI_REWRITE模块加载httpd.ini是可以实现重写和去掉index.php的,现在大部分windows服务器都升级为IIS7,重写方法也就不一样了。
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="OrgPage" stopProcessing="true">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_HOST}" pattern="^(.*)$" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration> |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
//保护系统路径的写法,在RewriteCond规则中写入开放的路径
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond $1 !^(index\.php|sitemap\.xml|robots \.txt|assets)
RewriteRule ^(.*)$ /index.php/$1
</IfModule>
//不保护系统路径的写法
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/system.*
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
</IfModule> |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
location / {
root $wwwroot;
index index.html index.htm index.php;
#rewrite规则如下:
rewrite ^/$ /index.php last;
rewrite ^/(?!index\.php|robots\.txt|static)(.*)$ /index.php/$1 last;
}
location ~ ^(.+\.php)(.*)$ {
root $wwwroot;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
#注意:去临时文件夹内找到你的php-cgi,也可能php-cgi.sock不是这么个名字。
fastcgi_pass unix:/tmp/php-cgi.sock;
include fastcgi_params;
} |
|
1 2 3 4 |
[ISAPI_Rewrite]
RewriteRule /httpd(?:\.ini|\.parse\.errors) / [F,I,O]
RewriteCond URL ^/(?!js|images|style|uploadfile|index\.php|robots\.txt|favicon\.ico).*
RewriteRule /(.*) /index.php/$1 [I,L] |
系统环境:Centos 5.5 32位
实现目标:SVN版本控制生产环境
1、检查依赖需求并下载必要包:
|
1 2 3 4 5 6 7 8 9 10 |
cd /usr/local/src
yum -y install gcc gcc-c++ openssl openssl-devel zlib
wget http://mirror.bjtu.edu.cn/apache/apr/apr-1.4.6.tar.gz
wget http://mirror.bjtu.edu.cn/apache/apr/apr-util-1.4.1.tar.gz
wget http://labs.renren.com/apache-mirror/subversion/subversion-1.7.4.tar.gz
wget http://subversion.tigris.org/downloads/subversion-deps-1.6.17.tar.gz
wget http://www.sqlite.org/sqlite-autoconf-3071100.tar.gz
wget http://icodex.org/dl/lnamp-1.0/src/pcre-8.12.tar.gz/mirror
wget http://labs.mop.com/apache-mirror//httpd/httpd-2.4.1.tar.gz |
2、解压并编译安装所有wget下来的包
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
tar -zxvf pcre-8.12.tar.gz
cd pcre-8.12/
./configure
make && make install
//编译SVN的时候可以选择Oracle berkeley-db,但我无视它了。
wget http://download.oracle.com/berkeley-db/db-5.3.15.tar.gz
tar zxf db-5.3.15.tar.gz
cd db-5.3.15/build_unix/
../dist/configure --prefix=/usr/local/berkeley-db --enable-compat185
make
make install
tar zvxf apr-1.4.6.tar.gz
cd apr-1.4.6
./configure --prefix=/usr/local/apr
make && make install
tar zvxf apr-util-1.4.1.tar.gz
cd apr-util-1.4.1
./configure --with-apr=/usr/local/apr
make && make install
tar zvxf httpd-2.4.1.tar.gz
cd httpd-2.4.1
./configure --prefix=/usr/local/apache --enable-so --enable-dav --enable-ssl --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr/bin/apu-1-config
make && make install
tar zvxf subversion-1.7.4.tar.gz
tar zvxf sqlite-autoconf-3071100.tar.gz
mkdir /usr/local/src/subversion-1.7.4/sqlite-amalgamation/
cp /usr/local/src/sqlite-autoconf-3071100/sqlite3.c /usr/local/src/subversion-1.7.4/sqlite-amalgamation/
cd subversion-1.7.4
./configure --prefix=/usr/local/subversion --with-apxs2=/usr/local/apache/bin/apxs --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr/bin/apu-1-config --with-berkeley-db=/usr/local/berkeley-db/ --with-apache-libexecdir=/usr/local/apache/modules --with-ssl --enable-maintainer-mode --with-zlib
mkdir -p /home/repository/
cd /usr/local/subversion/bin
./svnadmin create /home/repository/first_repos
chown -R www:www /home/repository/
启动SVN
/usr/local/subversion/bin/svnserve -d -T -r /home/repository
其中
-d 表示把进程svnserve作为守护进程在后台运行
-T 表示用多线程的方式处理数据
-r 可以有效地改变文件系统的根位置,客户端可以使用去掉前半部分的路径,留下的要短一些的(更加有提示性)URL
修改防火墙策略,开放SVN默认端口3690
/sbin/iptables -I INPUT -p tcp --dport 3690 -j ACCEPT
/sbin/iptables -I INPUT -p tcp --dport 443 -j ACCEPT
/etc/rc.d/init.d/iptables save |
服务器和SVN在同服务器的话,可以使用SVN作为项目中继节点,开发人员通过本地设计,然后通过SVN进行版本统一管理,继而在Commit的同时将新版本自动发布更新到网站或项目测试站点。
1、SVN客户端提交Commit请求后,更新文件自动推送更新至web测试(或正式)服务器.
假设在服务器上同时运行WEB服务,并且使用SVN进行版本管理,想实时更新版本库内的新文件到WEB进行测试或发布。即可按如下操作。
|
1 2 3 4 |
cd /home/repository/first_repos/hook
cd post-commit.tmpl pre-commit
chmod a+x post-commit
vi post-commit |
#以下为输入脚本
#!/bin/sh
/usr/local/svn/bin/svn update /var/www/html/ >>/home/repository/first_repos/hooks/svn_hook_log.txt
注意:如果出现如下错误,请查看:
1、权限是否对应到web目录(会造成钩子日志不生成),解决:killall svnserve,重新启动守护进程。
2、如果问题依旧,对web目录进行一次checkout。就可完全解决。
|
1 |
/usr/local/subversion/bin/svn checkout svn://192.168.1.98/mysvn/ /var/www/html |
Skipped 'var/www/html'
Summary of conflicts:
Skipped paths: 1
2、主从远程版本库同步(备份)
待续
3、多节点版本分支的分发同步。(多产品由一个项目所派生,版本库主干部分一致的分支派发结构)
待续
开场片段:宇航员发现纳粹月球基地
预告片:
FIREPHP官网:http://www.firephp.org/
firephp for mozilla(or firefox) add-ons:https://addons.mozilla.org/en-US/firefox/addon/firephp/
FirePHPCore library 核心库下载:http://www.firephp.org/DownloadRelease/FirePHPLibrary-FirePHPCore-0.3.2
//////////////////////////////////////////////
调试方法:
1、确认firefox已经安装了firebug组件。
2、安装firephp组件。
3、将FirePHPCore library 核心库文件放置于web目录需要的地方。
4、调用firephp 在程序入口或全局调用的位置加入:
|
1 2 3 4 5 6 7 |
/**
* firephp 调试器
*/
ob_start();
require(dirname(__FILE__) . '/includes/FirePHPCore/FirePHP.class.php');
$X = FirePHP::getInstance(true);
$X->setEnabled(true); // or FB:: |
5、输出记录值
|
1 2 3 4 5 6 |
$string = "我是要记录的内容。";
$X->log('LOG日志:'.$string);
$X->info('信息:'.$string);
$X->warn('警告:'.$string);
$X->error('致命错误:'.$string); |
也可使用以下方法:
|
1 2 3 4 5 |
//上面四条也可以这么用。
$X->fb('LOG日志:'.$string, FirePHP::LOG);
$X->fb('信息:'.$string, FirePHP::INFO);
$X->fb('警告:'.$string, FirePHP::WARN);
$X->fb('致命错误:'.$string, FirePHP::ERROR); |
6、堆栈跟踪
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
function hello() {
global $X;
$X->trace('Hello World!');
}
function ONE() {
hello();
}
function TWO() {
ONE();
}
TWO(); |
7、表格
|
1 2 3 4 5 6 7 |
$table = array();
$table[] = array('表格第一列','表格第二列');
$table[] = array('Row 1 Col 1','Row 1 Col 2');
$table[] = array('Row 2 Col 1','Row 2 Col 2');
$table[] = array('Row 3 Col 1','Row 3 Col 2');
$X->table('Table Label', $table); |
8、DUMP变量
|
1 2 3 4 5 6 7 |
$table = array();
$table[] = array('表格第一列','表格第二列');
$table[] = array('Row 1 Col 1','Row 1 Col 2');
$table[] = array('Row 2 Col 1','Row 2 Col 2');
$table[] = array('Row 3 Col 1','Row 3 Col 2');
$X->dump('value', $table); |
///////////////////////////////////////////////////