<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Justin's Tech Blog &#187; PHP</title>
	<atom:link href="http://www.sofee.cn/blog/category/technical/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sofee.cn/blog</link>
	<description>世界其实很简单，复杂的是人；生活其实很轻松，沉重的是感情！</description>
	<lastBuildDate>Sun, 17 Jan 2010 17:17:22 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>短域名在IE中无法设置子域名COOKIE的BUG</title>
		<link>http://www.sofee.cn/blog/2008/12/02/193/</link>
		<comments>http://www.sofee.cn/blog/2008/12/02/193/#comments</comments>
		<pubDate>Tue, 02 Dec 2008 08:29:40 +0000</pubDate>
		<dc:creator>Justin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[COOKIE]]></category>
		<category><![CDATA[短域名]]></category>
		<category><![CDATA[共享]]></category>
		<category><![CDATA[子域名]]></category>

		<guid isPermaLink="false">http://www.sofee.cn/blog/?p=193</guid>
		<description><![CDATA[对于域名投资者来说，当然是越短越好，然而对于IE来说，小于3位的域名就无法设置子域名COOKIE了。
最近就碰到这个BUG了，一直想不通IE为什么会出这种BUG，对于其他浏览器来说一点问题都没。
假设2台服务器如下：
127.0.0.1	www.6.cn
127.0.0.1	bbs.6.cn
在www.6.cn这台服务器上有个aa.php文件，源文件如下：

&#60;?php
setcookie&#40;&#34;aa&#34;, &#34;bb&#34;, time&#40;&#41;+3600, &#34;/&#34;, &#34;.6.cn&#34;&#41;;
echo '&#60;pre&#62;';
print_r&#40;$_COOKIE&#41;;
?&#62;

在bbs.6.cn这台服务器上有个bb.php文件，源文件如下：

&#60;?php
echo '&#60;pre&#62;';
print_r&#40;$_COOKIE&#41;;
?&#62;

这2个程序的作用就是能使子域名共享COOKIE，结果却因为这个域名小于3位，瞎忙活了1天，如果域名换成3位或3位以上，就一点问题都没，比如把6.cn换成123.cn就很正常。
暂时还没有找到解决办法，先留个帖子，看看以后是否有时间解决。
参考资料：http://curl.haxx.se/rfc/cookie_spec.html

Only hosts within the specified domain can set a cookie for a domain and domains must have at least two (2) or three (3) periods in them to prevent domains of the form: &#8220;.com&#8221;, &#8220;.edu&#8221;, and &#8220;va.us&#8221;. Any domain that fails within one of the seven special top level [...]]]></description>
		<wfw:commentRss>http://www.sofee.cn/blog/2008/12/02/193/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>解决IE中IFRAME无法保留SESSION的问题</title>
		<link>http://www.sofee.cn/blog/2008/11/25/190/</link>
		<comments>http://www.sofee.cn/blog/2008/11/25/190/#comments</comments>
		<pubDate>Tue, 25 Nov 2008 07:43:41 +0000</pubDate>
		<dc:creator>Justin</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[CWebBrowser2]]></category>
		<category><![CDATA[跨域]]></category>
		<category><![CDATA[IFRAME]]></category>
		<category><![CDATA[MFC]]></category>
		<category><![CDATA[P3P]]></category>
		<category><![CDATA[SESSION]]></category>

		<guid isPermaLink="false">http://www.sofee.cn/blog/?p=190</guid>
		<description><![CDATA[ 
var alimama_pid="mm_10006029_103557_106167"; 
var alimama_titlecolor="8ab459"; 
var alimama_descolor ="888888"; 
var alimama_bgcolor="FFFFFF"; 
var alimama_bordercolor="ffffff"; 
var alimama_linkcolor="8ab459"; 
var alimama_sizecode="12"; 
var alimama_width=468; 
var alimama_height=60; 
var alimama_type=2; 
 
 
 最近用C++开发一个基于WebBrowser的Application，界面都是在一个IFRAME里展示，由于需要会员登录模块，结果却出现在IFRAME里无法保留SESSION的问题，上MICROSOFT官方找到了答案：
@header(&#8216;P3P: CP=&#8221;CAO PSA OUR&#8221;&#8216;);
一句代码搞定！
P3P是微软的隐私策略，通常情况下跨域IFRAME或者FRAMESET默认采用的隐私策略为“中”，该级别的策略拒绝保留SESSION。CAO PSA OUR则意味着你同意跨域保留SESSION。
详细资料可以查看官方文档:http://support.microsoft.com/kb/323752

  addthis_url    = 'http%3A%2F%2Fwww.sofee.cn%2Fblog%2F2008%2F11%2F25%2F190%2F';
  addthis_title  = '%E8%A7%A3%E5%86%B3IE%E4%B8%ADIFRAME%E6%97%A0%E6%B3%95%E4%BF%9D%E7%95%99SESSION%E7%9A%84%E9%97%AE%E9%A2%98';
  addthis_pub    = 'sofeecn';

]]></description>
		<wfw:commentRss>http://www.sofee.cn/blog/2008/11/25/190/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Free UML 2 tool box &#8211; BOUML</title>
		<link>http://www.sofee.cn/blog/2008/08/29/167/</link>
		<comments>http://www.sofee.cn/blog/2008/08/29/167/#comments</comments>
		<pubDate>Fri, 29 Aug 2008 14:44:08 +0000</pubDate>
		<dc:creator>Justin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Review]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[BOUML]]></category>
		<category><![CDATA[Code Generator]]></category>
		<category><![CDATA[Code Reverse]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[UML]]></category>

		<guid isPermaLink="false">http://www.sofee.cn/blog/?p=167</guid>
		<description><![CDATA[
BOUML is a free UML 2 tool box (under development) allowing you to specify and generate code in C++, Java, Idl, Php and Python.
BOUML runs under Unix/Linux/Solaris, MacOS X(Power PC and Intel) and Windows.
BOUML is very fast and doesn&#8217;t require much memory to manage several thousands of classes, see benchmark.
BOUML is extensible, and the external [...]]]></description>
		<wfw:commentRss>http://www.sofee.cn/blog/2008/08/29/167/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Features in PHP 5.3</title>
		<link>http://www.sofee.cn/blog/2008/08/04/158/</link>
		<comments>http://www.sofee.cn/blog/2008/08/04/158/#comments</comments>
		<pubDate>Mon, 04 Aug 2008 01:54:53 +0000</pubDate>
		<dc:creator>Justin</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Review]]></category>
		<category><![CDATA[Namespace]]></category>
		<category><![CDATA[PHP-DEV]]></category>
		<category><![CDATA[命名空间]]></category>

		<guid isPermaLink="false">http://www.sofee.cn/blog/?p=158</guid>
		<description><![CDATA[8月1日，PHP5.3的第一个Alpha发布了，粗一看，改动的还不少啊，这下终于支持Namespace命名空间了，而我们需要做的尽量多做测试，哈哈。
具体的一些新功能可以查看此链接：http://cvs.php.net/viewvc.cgi/php-src/NEWS?view=markup&#038;pathrev=PHP_5_3

  addthis_url    = 'http%3A%2F%2Fwww.sofee.cn%2Fblog%2F2008%2F08%2F04%2F158%2F';
  addthis_title  = 'Features+in+PHP+5.3';
  addthis_pub    = 'sofeecn';

]]></description>
		<wfw:commentRss>http://www.sofee.cn/blog/2008/08/04/158/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Microsoft&#8217;s SQL Server 2005 driver for PHP</title>
		<link>http://www.sofee.cn/blog/2007/10/16/125/</link>
		<comments>http://www.sofee.cn/blog/2007/10/16/125/#comments</comments>
		<pubDate>Tue, 16 Oct 2007 13:30:48 +0000</pubDate>
		<dc:creator>Justin</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[扩展]]></category>

		<guid isPermaLink="false">http://www.sofee.cn/blog/2007/10/16/125/</guid>
		<description><![CDATA[真可谓PHP界的福音啊，微软最近也在PHP上频频有所作为，先是之前针对IIS对FASTCGI的支持，现在是为PHP写了个MSSQL的扩展。
新扩展与现有的MSSQL扩展的区别如下：
SQL Server 2000以后的数据库支持varchar存放大于255个字节的数据，而现有的只支持255个字节
现有的不支持nvarchar类型
新扩展没有PDO的实现
新扩展只能运行在WINDOWS平台
新扩展不提供源代码，只有DLL文件
新扩展支持data streams
新扩展在PHPINFO里将显示sqlsrv support enabled
更多信息请访问官方网站：http://www.microsoft.com/sql/technologies/php/default.mspx

  addthis_url    = 'http%3A%2F%2Fwww.sofee.cn%2Fblog%2F2007%2F10%2F16%2F125%2F';
  addthis_title  = 'Microsoft%26%238217%3Bs+SQL+Server+2005+driver+for+PHP';
  addthis_pub    = 'sofeecn';

]]></description>
		<wfw:commentRss>http://www.sofee.cn/blog/2007/10/16/125/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>PHP 5.3将支持namespace命名空间</title>
		<link>http://www.sofee.cn/blog/2007/09/30/118/</link>
		<comments>http://www.sofee.cn/blog/2007/09/30/118/#comments</comments>
		<pubDate>Sun, 30 Sep 2007 01:06:36 +0000</pubDate>
		<dc:creator>Justin</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Namespace]]></category>
		<category><![CDATA[内核开发]]></category>
		<category><![CDATA[命名空间]]></category>

		<guid isPermaLink="false">http://www.sofee.cn/blog/2007/09/30/118/</guid>
		<description><![CDATA[目前PHP的CVS已建立5.3版本的分支，并且已将namespace加进去，这绝对是个好消息，毕竟采用面向对象开发时有个namespace的功能非常有必要。
虽然之前由Greg Beaver发布的namespace patch没有获得支持，但是PHP内核开发人员还是提供了另一版本的patch，请看这里：http://news.php.net/php.zend-engine.cvs/6039。
同时也宣布一个消息，经过PHP内核开发人员的讨论，Johannes将成为PHP 5.3的发布管理者，请看这里：http://news.php.net/php.internals/32497。
希望将来会给大家带来一个更好的PHP版本。

  addthis_url    = 'http%3A%2F%2Fwww.sofee.cn%2Fblog%2F2007%2F09%2F30%2F118%2F';
  addthis_title  = 'PHP+5.3%E5%B0%86%E6%94%AF%E6%8C%81namespace%E5%91%BD%E5%90%8D%E7%A9%BA%E9%97%B4';
  addthis_pub    = 'sofeecn';

]]></description>
		<wfw:commentRss>http://www.sofee.cn/blog/2007/09/30/118/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>FastCGI Extension for PHP hosting on IIS5.1/IIS6.0</title>
		<link>http://www.sofee.cn/blog/2007/09/29/117/</link>
		<comments>http://www.sofee.cn/blog/2007/09/29/117/#comments</comments>
		<pubDate>Sat, 29 Sep 2007 02:00:37 +0000</pubDate>
		<dc:creator>Justin</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[FastCGI]]></category>
		<category><![CDATA[IIS]]></category>
		<category><![CDATA[WEB服务器]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.sofee.cn/blog/2007/09/29/117/</guid>
		<description><![CDATA[MS终于给IIS推出了FastCGI扩展了，这使PHP在IIS上作为CGI方式运行是提供了更好的性能和安全性。
用IIS作为WEB服务器的朋友们不妨尝试一下。
相关链接：

using PHP on IIS
download the FastCGI Extension Go Live
 Using FastCGI to host PHP applications on IIS7
 Configuring FastCGI Extension for IIS6.0 and IIS5.1


  addthis_url    = 'http%3A%2F%2Fwww.sofee.cn%2Fblog%2F2007%2F09%2F29%2F117%2F';
  addthis_title  = 'FastCGI+Extension+for+PHP+hosting+on+IIS5.1%2FIIS6.0';
  addthis_pub    = 'sofeecn';

]]></description>
		<wfw:commentRss>http://www.sofee.cn/blog/2007/09/29/117/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Howto Install Oracle Berkeley DB on Linux</title>
		<link>http://www.sofee.cn/blog/2007/08/18/100/</link>
		<comments>http://www.sofee.cn/blog/2007/08/18/100/#comments</comments>
		<pubDate>Sat, 18 Aug 2007 05:45:30 +0000</pubDate>
		<dc:creator>Justin</dc:creator>
				<category><![CDATA[Berkeley DB]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Berkeley-DB]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Db4]]></category>
		<category><![CDATA[Db4Cursor]]></category>
		<category><![CDATA[Db4Env]]></category>
		<category><![CDATA[Db4Txn]]></category>
		<category><![CDATA[ldconfig]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[php_db4]]></category>
		<category><![CDATA[php_dba]]></category>

		<guid isPermaLink="false">http://www.sofee.cn/blog/2007/08/18/100/</guid>
		<description><![CDATA[Berkeley DB是由美国Sleepycat Software公司开发的一套开放源代码的嵌入式数据库管理系统（已被Oracle收购），它为应用程序提供可伸缩的、高性能的、有事务保护功能的数据管理服务。
Berkeley DB为许多编程语言提供了实用的api接口，包括c、c++、java、perl、tcl、python和php等。所有同数据库相关的操作都由Berkeley DB函数库负责统一完成。
官方地址为：http://www.oracle.com/technology/products/berkeley-db/db/index.html
本文就先讲一下如何在CentOS下安装Berkeley DB数据库(其他系统类似)。
1、安装Berkeley DB

# cd /usr/local/src
# wget http://download.oracle.com/berkeley-db/db-4.6.18.tar.gz
# tar -zxvf db-4.6.18.tar.gz
# cd db-4.6.18
# cd build_unix

Berkeley DB默认是安装在/usr/local/BerkeleyDB.4.6目录下，其中4.6就是版本号，你也可以指定&#8211;prefix参数来设置安装目录。

# ../dist/configure --prefix=/usr/local/berkeleydb --enable-cxx

其中&#8211;enable-cxx就是编译C++库，这样才能编译Berkeley DB数据库的PHP扩展php_db4。

# make
# make install


# echo '/usr/local/berkeleydb/lib/' &#62;&#62; /etc/ld.so.conf
# ldconfig

这2句的作用就是通知系统Berkeley DB的动态链接库在/usr/local/berkeleydb/lib/目录。
至此，Berkeley DB数据库已经安装完成。

2、安装Berkeley DB的PHP扩展
虽然PHP里已经自带了php_db和php_dba两个扩展都支持Berkekey DB，但是毕竟支持的有限，所以还是编译Berkeley DB自带的php_db4扩展好。

# cd /usr/local/src/db-4.6.18/php_db4/
# phpize
# ./configure --with-db4=/usr/local/berkeleydb/
# make
# make install

至此db4已编译好在/usr/lib64/php/modules/db4.so目录(具体跟你的系统有关)

echo 'extension=db4.so' &#62; /etc/php.d/db4.ini

重起WEB服务器(Apache等)
至此php_db4扩展的安装也完成了，执行php -m即可看到db4扩展已经加载了。
3、测试php_db4扩展php_db4提供了下面4个类：

class Db4Env &#123;
    function Db4Env&#40;$flags [...]]]></description>
		<wfw:commentRss>http://www.sofee.cn/blog/2007/08/18/100/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>[小技巧]记录PHP错误日志</title>
		<link>http://www.sofee.cn/blog/2007/08/06/96/</link>
		<comments>http://www.sofee.cn/blog/2007/08/06/96/#comments</comments>
		<pubDate>Mon, 06 Aug 2007 08:26:42 +0000</pubDate>
		<dc:creator>Justin</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[display_errors]]></category>
		<category><![CDATA[error_log]]></category>
		<category><![CDATA[syslog]]></category>

		<guid isPermaLink="false">http://www.sofee.cn/blog/2007/08/06/96/</guid>
		<description><![CDATA[对于PHP开发人员来说，一旦某个产品投入使用，那么第一件事就是应该将display_errors选项关闭，以免因为这些错误所透露的路径、数据库连接、数据表等信息而遭到黑客攻击。
某个产品投入使用后，难免会有错误信息，那么如何记录这些对开发人员非常有用的信息呢？
将PHP的log_errors开启即可，默认是记录到WEB服务器的日志文件里，比如Apache的error.log文件。
当然也可以记录错误日志到指定的文件中。

# vim /etc/php.ini


display_errors = Off
log_errors = On
error_log = /var/log/php-error.log

另外也可以设定error_log = syslog，使这些错误信息记录到操作系统的日志里。

  addthis_url    = 'http%3A%2F%2Fwww.sofee.cn%2Fblog%2F2007%2F08%2F06%2F96%2F';
  addthis_title  = '%5B%E5%B0%8F%E6%8A%80%E5%B7%A7%5D%E8%AE%B0%E5%BD%95PHP%E9%94%99%E8%AF%AF%E6%97%A5%E5%BF%97';
  addthis_pub    = 'sofeecn';

]]></description>
		<wfw:commentRss>http://www.sofee.cn/blog/2007/08/06/96/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP COM应用之WPS篇</title>
		<link>http://www.sofee.cn/blog/2007/07/12/86/</link>
		<comments>http://www.sofee.cn/blog/2007/07/12/86/#comments</comments>
		<pubDate>Thu, 12 Jul 2007 03:52:16 +0000</pubDate>
		<dc:creator>Justin</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[COM]]></category>
		<category><![CDATA[PHP5]]></category>
		<category><![CDATA[WPS]]></category>
		<category><![CDATA[WPS-Office]]></category>
		<category><![CDATA[二次开发接口]]></category>

		<guid isPermaLink="false">http://www.sofee.cn/blog/2007/07/12/86/</guid>
		<description><![CDATA[本文仅仅是一个简单的例子来演示PHP通过COM扩展来调用WPS二次开发接口.

&#60;?php
$wps = new COM&#40;&#34;WPS.application&#34;&#41; or die&#40;&#34;Can't start WPS&#34;&#41;;
try &#123;
	$wps-&#62;Visible = true;
&#160;
	// Create Document
	$doc = $wps-&#62;Documents-&#62;Add&#40;&#41;;
	$doc-&#62;Range-&#62;Text = &#34;WPS v{$wps-&#62;Version} Example&#34;;
	$doc-&#62;Paragraphs&#91;1&#93;-&#62;Alignment = 1;
	$doc-&#62;Shapes-&#62;AddPicture&#40;&#34;http://img.kingsoft.com/publish/kingsoft/images/gb/sy/logo.gif&#34;, 80, 50, 148, 60&#41;;
&#160;
	$doc-&#62;SaveAs&#40;&#34;c:/php.wps&#34;&#41;;
&#160;
	// Close
	$wps-&#62;Quit&#40;&#41;;
&#125; catch &#40;com_exception $e&#41; &#123;
	echo $e;
&#125;
?&#62;

这段代码的执行结果是会在C盘下创建一个php.wps文件,文件内容如下图所示:


  addthis_url    = 'http%3A%2F%2Fwww.sofee.cn%2Fblog%2F2007%2F07%2F12%2F86%2F';
  addthis_title  = 'PHP+COM%E5%BA%94%E7%94%A8%E4%B9%8BWPS%E7%AF%87';
  addthis_pub    = 'sofeecn';

]]></description>
		<wfw:commentRss>http://www.sofee.cn/blog/2007/07/12/86/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>使用PHP的GD库来实现截屏</title>
		<link>http://www.sofee.cn/blog/2007/07/12/83/</link>
		<comments>http://www.sofee.cn/blog/2007/07/12/83/#comments</comments>
		<pubDate>Thu, 12 Jul 2007 03:42:43 +0000</pubDate>
		<dc:creator>Justin</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[COM]]></category>
		<category><![CDATA[GD]]></category>
		<category><![CDATA[imagegrabscreen]]></category>
		<category><![CDATA[imagegrabwindow]]></category>
		<category><![CDATA[InternetExplorer]]></category>
		<category><![CDATA[PHP5]]></category>
		<category><![CDATA[截屏]]></category>

		<guid isPermaLink="false">http://www.sofee.cn/blog/2007/07/12/83/</guid>
		<description><![CDATA[PHP5.2.2以上版本的GD库实现了两个截屏函数imagegrabscreen和imagegrabwindow，分别用于截取整个屏幕和截取某个窗口（同ALT+PrintScreen）的屏幕。
调用方法也很简单，请看下面两个例子：

1.截取整个屏幕：

&#60;?php
$im = imagegrabscreen&#40;&#41;;
imagepng&#40;$im, &#34;gd_screen.png&#34;&#41;;
?&#62;


2.截取IE浏览器的内容：

&#60;?php
$ie = new COM&#40;&#34;InternetExplorer.Application&#34;&#41; or die&#40;&#34;Can't start Internet Explorer&#34;&#41;;
try &#123;
	$handle = $ie-&#62;HWND;
	$ie-&#62;Visible = true;
	$ie-&#62;Navigate&#40;&#34;http://www.php.net&#34;&#41;;
&#160;
	while &#40;$ie-&#62;Busy&#41; &#123;
	    com_message_pump&#40;4000&#41;;
	&#125;
&#125; catch &#40;com_exception $e&#41; &#123;
	echo $e;
&#125;
&#160;
$im = imagegrabwindow&#40;$handle, 0&#41;;
imagepng&#40;$im, &#34;gd_window.png&#34;&#41;;
$ie-&#62;Quit&#40;&#41;;
?&#62;



  addthis_url    = 'http%3A%2F%2Fwww.sofee.cn%2Fblog%2F2007%2F07%2F12%2F83%2F';
  addthis_title  = '%E4%BD%BF%E7%94%A8PHP%E7%9A%84GD%E5%BA%93%E6%9D%A5%E5%AE%9E%E7%8E%B0%E6%88%AA%E5%B1%8F';
  addthis_pub    = 'sofeecn';

]]></description>
		<wfw:commentRss>http://www.sofee.cn/blog/2007/07/12/83/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>PHP namespaces came back!</title>
		<link>http://www.sofee.cn/blog/2007/07/06/80/</link>
		<comments>http://www.sofee.cn/blog/2007/07/06/80/#comments</comments>
		<pubDate>Fri, 06 Jul 2007 02:50:56 +0000</pubDate>
		<dc:creator>Justin</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[ZEND API]]></category>
		<category><![CDATA[eAccelerator]]></category>
		<category><![CDATA[MMCache]]></category>
		<category><![CDATA[Namespace]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP5]]></category>
		<category><![CDATA[PHP6]]></category>
		<category><![CDATA[Zend]]></category>
		<category><![CDATA[ZEND-API]]></category>
		<category><![CDATA[Zend-Framework]]></category>
		<category><![CDATA[命名空间]]></category>

		<guid isPermaLink="false">http://www.sofee.cn/blog/2007/07/06/80/</guid>
		<description><![CDATA[近期PHP邮件列表最引人注目的应该就是namespace的开发了，Dmitry Stogov已经为PHP6打了个补丁，不过看上去已经很完美了。具体可以点这里看他发的帖子：Simple Namespace Proposal。
还记得以前PHP 5.0.0 alpha或beta的时候就已经支持namespace了，可后来推出正式版后却因为种种原因还是去掉了。现在想想namespace是越来越有用了，特别是针对Zend Framework这类框架的应用，颇有感触！希望经过这次的讨论之后会正式把这个功能加进来。

下面是相关代码的引用：

Namespaces are defined the following way:

Zend/DB/Connection.php: 
&#60;?php 
namespace Zend::DB;
&#160;
class Connection &#123;
&#125;
&#160;
function connect&#40;&#41; &#123;
&#125;
?&#62;

Namespace definition does the following:
All class and function names inside are automatically prefixed with
namespace name. Inside namespace, local name always takes precedence over
global name. It is possible to use the same namespace in several PHP files.
The namespace [...]]]></description>
		<wfw:commentRss>http://www.sofee.cn/blog/2007/07/06/80/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>自行编译安装PHP</title>
		<link>http://www.sofee.cn/blog/2007/06/25/71/</link>
		<comments>http://www.sofee.cn/blog/2007/06/25/71/#comments</comments>
		<pubDate>Mon, 25 Jun 2007 04:45:48 +0000</pubDate>
		<dc:creator>Justin</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[lib64]]></category>
		<category><![CDATA[libmysqlclient.so]]></category>
		<category><![CDATA[mysqlclient]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP5]]></category>

		<guid isPermaLink="false">http://www.sofee.cn/blog/2007/06/25/71/</guid>
		<description><![CDATA[实际上这种文章已经很多了，网上也到处都是，之所以写这篇文章，目的是为了解决其中一个问题。

# cd /usr/local/src
# wget http://cn.php.net/distributions/php-5.2.3.tar.gz
# tar -zxvf php-5.2.3.tar.gz
# cd php-5.2.3
# ./configure --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --target=x86_64-redhat-linux-gnu --program-prefix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info --cache-file=../config.cache --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --enable-force-cgi-redirect --disable-debug --enable-pic --disable-rpath --enable-inline-optimization --with-exec-dir=/usr/bin --with-freetype-dir --with-png-dir=/usr/local --with-gd=shared --enable-gd-native-ttf --with-iconv --with-jpeg-dir=/usr/local --with-openssl --with-png --with-pcre-regex --with-zlib --with-layout=GNU --enable-magic-quotes --enable-sockets --enable-sysvsem --enable-sysvshm --enable-track-vars --enable-trans-sid --enable-memory-limit [...]]]></description>
		<wfw:commentRss>http://www.sofee.cn/blog/2007/06/25/71/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>发布最新编译的PHP中文手册</title>
		<link>http://www.sofee.cn/blog/2007/06/20/56/</link>
		<comments>http://www.sofee.cn/blog/2007/06/20/56/#comments</comments>
		<pubDate>Wed, 20 Jun 2007 10:11:13 +0000</pubDate>
		<dc:creator>Justin</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[manual]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[中文手册]]></category>

		<guid isPermaLink="false">http://www.sofee.cn/blog/2007/06/20/56/</guid>
		<description><![CDATA[一直觉得很奇怪，为什么PHP官方编译的PHP中文手册的索引是乱码，而自己编译的就没问题，难道那人是台湾人？或是比较喜欢用繁体字？搞的那么多国内用户看着繁体不爽，主要是索引乱码不爽。
因为自己前几年写的自己动手编译PHP手册的底稿已不存在，故在网上搜了一下，发现多如牛毛，几乎都是转载偶的那篇文章，同时也觉得可笑，以后自己的文章要是不见了，到网上一搜没准都能找到，不管有多老，呵呵。
下面附上2007年6月20日编译的PHP中文手册下载。php_manual_zh.chm.tar.gz
备注：请大家下载后，将文件名改为php_manual_zh.chm.tar.gz再解压缩，因为WordPress的原因自动将.tar.gz后缀的文件名改为tar.gz了。

  addthis_url    = 'http%3A%2F%2Fwww.sofee.cn%2Fblog%2F2007%2F06%2F20%2F56%2F';
  addthis_title  = '%E5%8F%91%E5%B8%83%E6%9C%80%E6%96%B0%E7%BC%96%E8%AF%91%E7%9A%84PHP%E4%B8%AD%E6%96%87%E6%89%8B%E5%86%8C';
  addthis_pub    = 'sofeecn';

]]></description>
		<wfw:commentRss>http://www.sofee.cn/blog/2007/06/20/56/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SMART STRING API</title>
		<link>http://www.sofee.cn/blog/2006/11/24/8/</link>
		<comments>http://www.sofee.cn/blog/2006/11/24/8/#comments</comments>
		<pubDate>Fri, 24 Nov 2006 04:41:20 +0000</pubDate>
		<dc:creator>Justin</dc:creator>
				<category><![CDATA[ZEND API]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[ZEND-API]]></category>

		<guid isPermaLink="false">http://www.sofee.cn/blog/?p=8</guid>
		<description><![CDATA[SMART STRING API
This article was copied from http://www.akbkhome.com/blog.php/View/111/smart_str_API.html
from:

#include &#34;ext/standard/php_smart_str.h&#34;

The Struct:

1
2
3
4
5
typedef struct &#123;
char *c;      // data goes here..
size_t len;     // the current length
size_t a;    // the allocated size
&#125; smart_str;

EXAMPLE:

1
2
3
4
5
6
7
8
smart_str *sstr;
sstr = emalloc&#40;sizeof&#40;smart_str&#41;&#41;;
smart_str_sets&#40;sstr, strdup&#40;&#34;&#34;&#41;&#41;; // start it clean.    .....
smart_str_free&#40;sstr&#41;;
smart_str sstr = &#123;0&#125;;
smart_str_alloc&#40;&#38;sstr, [...]]]></description>
		<wfw:commentRss>http://www.sofee.cn/blog/2006/11/24/8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[老文章 ]PHP5 &amp; Web Services 系统架构图</title>
		<link>http://www.sofee.cn/blog/2006/08/23/32/</link>
		<comments>http://www.sofee.cn/blog/2006/08/23/32/#comments</comments>
		<pubDate>Wed, 23 Aug 2006 06:45:56 +0000</pubDate>
		<dc:creator>Justin</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Web Services]]></category>
		<category><![CDATA[Dia]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP5]]></category>
		<category><![CDATA[SOAP]]></category>
		<category><![CDATA[WSDL]]></category>

		<guid isPermaLink="false">http://www.sofee.cn/blog/?p=32</guid>
		<description><![CDATA[注：此文章由本人CSDN上的BLOG迁移过来
最近在做一个项目，有大量的数据需要实时更新，同时要求多台服务器可共享这些数据，类似于股票系统，因此决定使用B/S+中间层三层架构，其中使用Web Services作为中间层，原因在于，从长远角度来考虑，以后可能会增加C/S结构，所以采用Web Services是个绝好的选择。
系统架构图如下：


由于考虑到PHP5已日趋成熟，且SOAP扩展也已比较完善，所以WEB服务器端脚本语言采用PHP5开发，而Web Services服务器端和MySQL数据库服务器端可考虑放在同一台服务器上。
Web Services服务器端、客户端以及WSDL等文件可采用Dia工具自动生成，非常方便！

  addthis_url    = 'http%3A%2F%2Fwww.sofee.cn%2Fblog%2F2006%2F08%2F23%2F32%2F';
  addthis_title  = '%5B%E8%80%81%E6%96%87%E7%AB%A0+%5DPHP5+%26%23038%3B+Web+Services+%E7%B3%BB%E7%BB%9F%E6%9E%B6%E6%9E%84%E5%9B%BE';
  addthis_pub    = 'sofeecn';

]]></description>
		<wfw:commentRss>http://www.sofee.cn/blog/2006/08/23/32/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[老文章]SQLite数据库安全</title>
		<link>http://www.sofee.cn/blog/2006/06/27/23/</link>
		<comments>http://www.sofee.cn/blog/2006/06/27/23/#comments</comments>
		<pubDate>Mon, 26 Jun 2006 16:12:41 +0000</pubDate>
		<dc:creator>Justin</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[SQLite]]></category>
		<category><![CDATA[Access]]></category>
		<category><![CDATA[CGI]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP5]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[安全]]></category>

		<guid isPermaLink="false">http://www.sofee.cn/blog/?p=23</guid>
		<description><![CDATA[相信使用PHP开发的人员一定不会对SQLite感到陌生了，PHP5已经集成了这个轻量型的数据库。SQLite�任何限制的授权协议以及支持大部分标准的SQL 92语句，相信会有越来越多的人使用这个数据库。作为WEB开发而言，PHP与SQLite的结合就如同当年的ASP与ACCESS结合一样，ACCESS可以遭遇被人下载，SQLite同样不能幸免，毕竟SQLite也是一个二进制文件，只要WEB能访问到的，就能被下载。ACCESS可以采用一些诡计来防止用户下载，SQLite同样可以，下面偶就将一些网上收集过来的解决方案贴在这里。
1、将SQLite放在WEB不能访问到的地方。
有些虚拟主机一般也都会提供一个单独目录，供用户放一些不想被下载或访问的文件，所以放在这个目录很安全。
2、如果PHP是作为CGI或者APACHE的单独进程运行，那么可以修改一下SQLite数据库文件的权限，比如0600。
3、假如WEB服务器是APACHE，并且支持自定义.htaccess，那么可在.htaccess文件中加入以下内容：

&#60;FilesMatch &#34;.sqlite$&#34;&#62;
Deny from all
&#60;/FilesMatch&#62;

其中.sqlite即为他的数据库文件的扩展名。
4、Ilia]]></description>
		<wfw:commentRss>http://www.sofee.cn/blog/2006/06/27/23/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP-GTK Example: Splash</title>
		<link>http://www.sofee.cn/blog/2006/06/27/22/</link>
		<comments>http://www.sofee.cn/blog/2006/06/27/22/#comments</comments>
		<pubDate>Mon, 26 Jun 2006 16:07:27 +0000</pubDate>
		<dc:creator>Justin</dc:creator>
				<category><![CDATA[PHP-GTK]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.sofee.cn/blog/?p=22</guid>
		<description><![CDATA[
&#60;?php
class splash &#123;
	var $gui = null;
	var $times = null;
&#160;
	function splash&#40;&#41; &#123;
		$this-&#62;gui = array&#40;&#41;; // 初始化
		$this-&#62;times = 0;
	&#125;
&#160;
	/**
	* 运行主程序
	*/
	function run&#40;&#41; &#123;
		$this-&#62;gui&#91;'splash'&#93; = &#38;new GtkWindow&#40;GTK_WINDOW_POPUP&#41;;
		$this-&#62;gui&#91;'splash'&#93;-&#62;set_position&#40;GTK_WIN_POS_CENTER&#41;;
		$this-&#62;gui&#91;'splash'&#93;-&#62;set_usize&#40;365, 221&#41;;
		$this-&#62;gui&#91;'vbox'&#93; = &#38;new GtkVbox&#40;false, 0&#41;;
&#160;
		// load pixmap
		list&#40;$pixmap, $mask&#41; = Gdk::pixmap_create_from_xpm&#40;$this-&#62;gui&#91;'splash'&#93;-&#62;window, null, 'splash.xpm'&#41;;
		$splash = &#38;new GtkPixmap&#40;$pixmap, $mask&#41;;
&#160;
		// add the image to the box
		$this-&#62;gui&#91;'vbox'&#93;-&#62;add&#40;$splash&#41;;
&#160;
		// load loading label
		$this-&#62;gui&#91;'loading'&#93; = &#38;new GtkLabel&#40;&#41;;
&#160;
		// add the loading label [...]]]></description>
		<wfw:commentRss>http://www.sofee.cn/blog/2006/06/27/22/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[老文章 ]使用VC++开发PHP扩展注意事项</title>
		<link>http://www.sofee.cn/blog/2006/06/26/20/</link>
		<comments>http://www.sofee.cn/blog/2006/06/26/20/#comments</comments>
		<pubDate>Mon, 26 Jun 2006 15:42:19 +0000</pubDate>
		<dc:creator>Justin</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[ZEND API]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP扩展]]></category>
		<category><![CDATA[VC++]]></category>
		<category><![CDATA[ZEND-API]]></category>

		<guid isPermaLink="false">http://www.sofee.cn/blog/?p=20</guid>
		<description><![CDATA[一、默认情况下，C++是使用.cpp作为扩展名的，而PHP是用C写的，因此必须使用C++提供的C连接交换指定符号extern &#8220;C&#8221;来解决这个问题，以下两部分语句必须被包含：

extern &#34;C&#34; &#123;
#include &#34;php.h&#34;
#include &#34;php_ini.h&#34;
#include &#34;ext/standard/info.h&#34;
... // 其他C头文件
&#125;

和

extern &#34;C&#34; &#123;
#ifdef COMPILE_DL_MYEXT
ZEND_GET_MODULE&#40;myext&#41;
#endif
&#125;


二、STL模版定义是不能被包含在C连接交换指定符的，而PHP需用到math.h这个头文件，因此编译的时候会产生math.h(514) error c2894: templates cannot be declared to have &#8216;C&#8217; linkage的错误信息，要解决这个问题，需在� 的CPP文件头部也就是extern &#8220;C&#8221;连接符之前加 入以下代码：

#ifdef WIN32
#include &#60;math.h&#62;
#endif

三、同C中一样，必须先在头文件（如：php_myext.h）中申明所有函数原型，如果没有使用头文件，那么必须在CPP文件（如：ext.cpp）的zend function结构之间申明所有函数原型，也就是在如下代码之前：

function_entry myext_functions&#91;&#93; = &#123;
PHP_FE&#40;confirm_myext_compiled, NULL&#41; /* For testing, remove later. */
&#123;NULL, NULL, NULL&#125;
&#125;;


  addthis_url    = 'http%3A%2F%2Fwww.sofee.cn%2Fblog%2F2006%2F06%2F26%2F20%2F';
  addthis_title  = '%5B%E8%80%81%E6%96%87%E7%AB%A0+%5D%E4%BD%BF%E7%94%A8VC%2B%2B%E5%BC%80%E5%8F%91PHP%E6%89%A9%E5%B1%95%E6%B3%A8%E6%84%8F%E4%BA%8B%E9%A1%B9';
  addthis_pub  [...]]]></description>
		<wfw:commentRss>http://www.sofee.cn/blog/2006/06/26/20/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[老文章]从PHP源代码修改phpinfo中的LOGO及彩蛋</title>
		<link>http://www.sofee.cn/blog/2006/06/26/19/</link>
		<comments>http://www.sofee.cn/blog/2006/06/26/19/#comments</comments>
		<pubDate>Mon, 26 Jun 2006 15:25:28 +0000</pubDate>
		<dc:creator>Justin</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[ZEND API]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP扩展]]></category>
		<category><![CDATA[ZEND-API]]></category>

		<guid isPermaLink="false">http://www.sofee.cn/blog/?p=19</guid>
		<description><![CDATA[1. 大家先来看一段PHP代码（gif2h.php）：

&#60;?php
// 将GIF转换为C语言中的H文件
$filename = &#34;mylogo.gif&#34;;
$fp = f open&#40;$filename, &#34;rb&#34;&#41;;
$buffer = f read&#40;$fp, filesize&#40;$filename&#41;&#41;;
f close&#40;$fp&#41;;
$len = strlen&#40;$buffer&#41;;
$fp = f open&#40;&#34;mylogo.h&#34;, &#34;wb&#34;&#41;;
f write&#40;$fp, &#34;unsigned char php_logo[] = {&#34;&#41;;
for &#40;$i=0; $i&#60;=$len; $i++&#41; &#123;
	if&#40;$i % 10 == 0&#41; &#123;
		f write&#40;$fp, &#34;\n\t\t&#34;&#41;;
	&#125;
	if&#40;$i == $len&#41; &#123;
		$str = str_pad&#40;ord&#40;substr&#40;$buffer, $i, 1&#41;&#41;, 3, &#34; &#34;, STR_PAD_LEFT&#41;;
	&#125; else &#123;
		$str = str_pad&#40;ord&#40;substr&#40;$buffer, $i, 1&#41;&#41;, 3, [...]]]></description>
		<wfw:commentRss>http://www.sofee.cn/blog/2006/06/26/19/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
