<?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>GCCFeli.cn &#187; Php</title> <atom:link href="http://gccfeli.cn/tag/php/feed" rel="self" type="application/rss+xml" /><link>http://gccfeli.cn</link> <description></description> <lastBuildDate>Thu, 14 Jul 2011 08:18:00 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.1</generator> <atom:link rel='hub' href='http://gccfeli.cn/?pushpress=hub'/> <item><title>PHP 实现守护进程</title><link>http://gccfeli.cn/2009/12/php-daemon.html</link> <comments>http://gccfeli.cn/2009/12/php-daemon.html#comments</comments> <pubDate>Thu, 03 Dec 2009 16:06:46 +0000</pubDate> <dc:creator>Felicia</dc:creator> <category><![CDATA[Php]]></category> <category><![CDATA[守护进程]]></category><guid
isPermaLink="false">http://gccfeli.cn/2009/12/php-%e5%ae%9e%e7%8e%b0%e5%ae%88%e6%8a%a4%e8%bf%9b%e7%a8%8b.html</guid> <description><![CDATA[<p>很早以前就有用PHP实现守护进程的想法，无奈实验了很多次（包括跟Felix一起做的实验），结果都是关掉浏览器，PHP脚本就停止运行了。</p><p>今天无意中找到两个函数，想着或许对实现守护进程有帮助，他们是：</p><div
class="hl-wrapper"> <span
class="readmore"><a
href="http://gccfeli.cn/2009/12/php-daemon.html" title="PHP 实现守护进程">阅读全文（557字）</a></span>]]></description> <content:encoded><![CDATA[<p>很早以前就有用PHP实现守护进程的想法，无奈实验了很多次（包括跟Felix一起做的实验），结果都是关掉浏览器，PHP脚本就停止运行了。</p><p>今天无意中找到两个函数，想着或许对实现守护进程有帮助，他们是：</p><div
class="hl-wrapper"><div
class="hl-surround"><div
class="hl-main"><span
class="hl-inlinetags">&lt;?php</span><span
class="hl-code"><br
/></span><span
class="hl-identifier">void</span><span
class="hl-code"> </span><span
class="hl-identifier">set_time_limit</span><span
class="hl-brackets">(</span><span
class="hl-identifier">int</span><span
class="hl-code"> </span><span
class="hl-identifier">seconds</span><span
class="hl-brackets">)</span><span
class="hl-code">; </span><span
class="hl-comment">//配置页面最长执行时间</span><span
class="hl-code"><br
/></span><span
class="hl-identifier">void</span><span
class="hl-code"> </span><span
class="hl-identifier">ignore_user_abort</span><span
class="hl-brackets">(</span><span
class="hl-identifier">bool</span><span
class="hl-code"> </span><span
class="hl-identifier">setting</span><span
class="hl-brackets">)</span><span
class="hl-code">; </span><span
class="hl-comment">//设置是否忽略用户终止操作</span><span
class="hl-code"><br
/></span><span
class="hl-inlinetags">?&gt;</span></div></div></div><p>我的设想是，把页面最长执行时间设置成0，相当于页面脚本可以无限时运行，并且设置忽略用户终止操作。<br
/> 测试代码如下</p><div
class="hl-wrapper"><div
class="hl-surround"><div
class="hl-main"><span
class="hl-inlinetags">&lt;?php</span><span
class="hl-code"><br
/></span><span
class="hl-identifier">set_time_limit</span><span
class="hl-brackets">(</span><span
class="hl-number">0</span><span
class="hl-brackets">)</span><span
class="hl-code">;<br
/></span><span
class="hl-identifier">ignore_user_abort</span><span
class="hl-brackets">(</span><span
class="hl-reserved">true</span><span
class="hl-brackets">)</span><span
class="hl-code">;<br
/>&nbsp;<br
/></span><span
class="hl-reserved">while</span><span
class="hl-code"> </span><span
class="hl-brackets">(</span><span
class="hl-reserved">true</span><span
class="hl-brackets">)</span><span
class="hl-code"> </span><span
class="hl-brackets">{</span><span
class="hl-code"><br
/>&nbsp;&nbsp; &nbsp;</span><span
class="hl-var">$fp</span><span
class="hl-code"> = </span><span
class="hl-identifier">fopen</span><span
class="hl-brackets">(</span><span
class="hl-quotes">'</span><span
class="hl-string">test.txt</span><span
class="hl-quotes">'</span><span
class="hl-code">, </span><span
class="hl-quotes">'</span><span
class="hl-string">a</span><span
class="hl-quotes">'</span><span
class="hl-brackets">)</span><span
class="hl-code">;<br
/>&nbsp;&nbsp; &nbsp;</span><span
class="hl-identifier">fwrite</span><span
class="hl-brackets">(</span><span
class="hl-var">$fp</span><span
class="hl-code">, </span><span
class="hl-identifier">date</span><span
class="hl-brackets">(</span><span
class="hl-quotes">&quot;</span><span
class="hl-string">Y-m-d H:i:s</span><span
class="hl-quotes">&quot;</span><span
class="hl-brackets">)</span><span
class="hl-code">.</span><span
class="hl-quotes">&quot;</span><span
class="hl-special">\n</span><span
class="hl-quotes">&quot;</span><span
class="hl-brackets">)</span><span
class="hl-code">;<br
/>&nbsp;&nbsp; &nbsp;</span><span
class="hl-identifier">fclose</span><span
class="hl-brackets">(</span><span
class="hl-var">$fp</span><span
class="hl-brackets">)</span><span
class="hl-code">;<br
/>&nbsp;&nbsp; &nbsp;</span><span
class="hl-identifier">sleep</span><span
class="hl-brackets">(</span><span
class="hl-number">1</span><span
class="hl-brackets">)</span><span
class="hl-code">;<br
/></span><span
class="hl-brackets">}</span><span
class="hl-code"><br
/></span><span
class="hl-inlinetags">?&gt;</span></div></div></div><p>在本机win7和meyu服务器(linux)，都测试通过了，test.txt在用户关闭浏览器之后仍然不断增长。</p><p>到现在为止在服务器上脚本运行了14分钟（在浏览器关闭之后，用ftp查看test.txt），仍然在继续增长，说明测试进程仍然在执行。</p><p><del>至此，可以证明PHP能够实现守护进程了。</del><br
/> 早上起来发现测试进程停止了……一共执行了20分钟，晕，实验还是失败了。</p> ]]></content:encoded> <wfw:commentRss>http://gccfeli.cn/2009/12/php-daemon.html/feed</wfw:commentRss> <slash:comments>14</slash:comments> </item> <item><title>php 关于文件包含的问题</title><link>http://gccfeli.cn/2008/09/php-include.html</link> <comments>http://gccfeli.cn/2008/09/php-include.html#comments</comments> <pubDate>Fri, 26 Sep 2008 09:11:02 +0000</pubDate> <dc:creator>Felicia</dc:creator> <category><![CDATA[Php]]></category> <category><![CDATA[include]]></category><guid
isPermaLink="false">http://www.gccfeli.cn/?p=268</guid> <description><![CDATA[<p>get_included_files() 是查看&#8221;我&#8221;调用了哪些文件<br
/> debug_backtrace() 是查看哪些文件调用了&#8221;我&#8221;</p> ]]></description> <content:encoded><![CDATA[<p>get_included_files() 是查看&#8221;我&#8221;调用了哪些文件<br
/> debug_backtrace() 是查看哪些文件调用了&#8221;我&#8221;</p> ]]></content:encoded> <wfw:commentRss>http://gccfeli.cn/2008/09/php-include.html/feed</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>IAC(Incoming ACM/ICPC Contests) 0.1 Beta 发布</title><link>http://gccfeli.cn/2008/02/iacincoming-acmicpc-contests-01-beta-release.html</link> <comments>http://gccfeli.cn/2008/02/iacincoming-acmicpc-contests-01-beta-release.html#comments</comments> <pubDate>Mon, 25 Feb 2008 16:32:26 +0000</pubDate> <dc:creator>Felicia</dc:creator> <category><![CDATA[网络技术]]></category> <category><![CDATA[IAC]]></category> <category><![CDATA[MySQL]]></category> <category><![CDATA[Php]]></category><guid
isPermaLink="false">http://www.gccfeli.cn/?p=136</guid> <description><![CDATA[<p>最近学了点 php 和 MySQL，想做个东西练练手。于是就写了个自动获取最新的 ACM 比赛的程序。目前版本是 0.1 Beta，功能正在不断完善中。</p><p>有兴趣的网友可以点击<a
href="http://gccfeli.cn/iac">最近比赛</a>页面，查看由我的程序自动获取的最近比赛列表。<br
/> <br
/> <span
class="readmore"><a
href="http://gccfeli.cn/2008/02/iacincoming-acmicpc-contests-01-beta-release.html" title="IAC(Incoming ACM/ICPC Contests) 0.1 Beta 发布">阅读全文（395字）</a></span>]]></description> <content:encoded><![CDATA[<p>最近学了点 php 和 MySQL，想做个东西练练手。于是就写了个自动获取最新的 ACM 比赛的程序。目前版本是 0.1 Beta，功能正在不断完善中。</p><p>有兴趣的网友可以点击<a
href="http://gccfeli.cn/iac">最近比赛</a>页面，查看由我的程序自动获取的最近比赛列表。<br
/> <span
id="more-136"></span><br
/> 目前支持的 OJ 有：</p><ol><li>Uva</li><li>Ural</li><li>Zju</li><li>Pku(由于没有最近的比赛，故不显示)</li><li>Whu</li><li>Ecnu</li><li>Tju(Virtual Contests)</li></ol><p>由于网页脚本是被动触发的，如果前一个小时无人访问<a
href="http://gccfeli.cn/iac">最近比赛</a>页面，那么程序会自动登陆各 OJ 搜集比赛数据，需要一定的时间。请耐心等待，不要关闭网页。如果经常有人访问我的网页，那么速度应该会很快啦：）</p><p>大家可以回复这篇文章，对 IAC 提出意见和建议，我会努力改进的。</p><p>更新记录：</p><ul><li>2008-02-26 加入到比赛的链接</li><li>2008-02-26 加入对 Whu 的支持</li><li>2008-02-29 加入对 Ecnu 的支持</li><li>2008-03-01 加入对 Tju(Virtual Contests) 的支持</li></ul> ]]></content:encoded> <wfw:commentRss>http://gccfeli.cn/2008/02/iacincoming-acmicpc-contests-01-beta-release.html/feed</wfw:commentRss> <slash:comments>18</slash:comments> </item> <item><title>Vista 下 Apache + MySQL + php 安装手记</title><link>http://gccfeli.cn/2008/02/vista-apache-mysql-php-install.html</link> <comments>http://gccfeli.cn/2008/02/vista-apache-mysql-php-install.html#comments</comments> <pubDate>Sat, 23 Feb 2008 13:14:44 +0000</pubDate> <dc:creator>Felicia</dc:creator> <category><![CDATA[网络技术]]></category> <category><![CDATA[Apache]]></category> <category><![CDATA[MySQL]]></category> <category><![CDATA[Php]]></category> <category><![CDATA[Vista]]></category><guid
isPermaLink="false">http://www.gccfeli.cn/?p=133</guid> <description><![CDATA[<p>因为使用 WordPress 的 Blog 系统，不免会碰到一些 php 问题，也想自己写一些 php 程序，所以在本本上安装了 Apache + MySQL + php 的 Web 开发平台。在 Vista 下安装这些东西挺麻烦的，网上有很多相关的文章，但大都解决不了问题。我参考了一些文章，把过程总结一下。</p><ol><li><b>安装环境</b> <br
/>操作系统是 <b>Windows Vista Ultimate</b> 中文版, Apache, PHP, MySQL 的最新版本可以在其官网下载的: <span
class="readmore"><a
href="http://gccfeli.cn/2008/02/vista-apache-mysql-php-install.html" title="Vista 下 Apache + MySQL + php 安装手记">阅读全文（2609字）</a></span>]]></description> <content:encoded><![CDATA[<p>因为使用 WordPress 的 Blog 系统，不免会碰到一些 php 问题，也想自己写一些 php 程序，所以在本本上安装了 Apache + MySQL + php 的 Web 开发平台。在 Vista 下安装这些东西挺麻烦的，网上有很多相关的文章，但大都解决不了问题。我参考了一些文章，把过程总结一下。</p><ol><li><b>安装环境</b> <br
/>操作系统是 <b>Windows Vista Ultimate</b> 中文版, Apache, PHP, MySQL 的最新版本可以在其官网下载的:<ul><li><b>Apache ：</b><a
href="http://httpd.apache.org/download.cgi">http://httpd.apache.org/download.cgi</a></a></li><li><b>PHP：</b> <a
href="http://www.php.net/downloads.php"></a><a
href="http://www.php.net/downloads.php">http://www.php.net/downloads.php</a></a></li><li><b>MySQL：</b><a
href="http://dev.mysql.com/downloads/"></a><a
href="http://dev.mysql.com/downloads/">http://dev.mysql.com/downloads/</a></a></li></ul></li><li><b>安装的目录结构规划</b> <br
/>为了方便维护，以及重装系统时不必进行二次安装，建议不要将其安装在系统盘（默认是 C 盘），例如我是装在 F 盘。安装路径也最好不要含有空格和中文字符。 <br
/>我的目录结构规划如下：<pre><tt>&lt;F:&gt;
|--&lt;WWW&gt;
|   |--&lt;SERVER&gt;        # 安装 Web 服务程序
|   |   |--&lt;Apache&gt;    # Apache安装目录
|   |   |--&lt;MySQL&gt;     # MySql安装目录
|   |   |--&lt;PHP&gt;       # PHP安装目录
|   |
|   |--&lt;Web&gt;     # 网站内容
|   |   |--&lt;test.php&gt;
|   |   |--&lt;其它PHP程序&gt;
</tt></pre><p>下面的安装说明的举例，以上列目录结构为准。</li><li><b>在 Windows Vista 下安装 Apache 2.2.8</b><p>Windows Vista 下的安装，主要是由于 UAC 权限的影响，有可能导致服务无法安装成功。但这并不要紧，可以手工解决</p><ol><li>运行 A<b>pache 2.2.8 的安装程序</b>，根据提示一路 Next 即可。注意在 <b>Server Information</b> 的 <b>Network Domain、Server Name</b> 字段填上 localhost，在安装类型的位置选 <b>Custom</b>，然后改变安装路径（我的目录是 F:WWWSERVERApache）。然后根据提示一路 Next 完成即可。</li></ol><ol><li>进入 DOS 窗口后，执行下列命令<pre><tt># 进入 Apache 的安装目录
C:windowssystem32&gt; f:
F:&gt; cd f:WWWSERVERApachebin
# 安装 Apache 服务：
F:WWWSERVERApachebin&gt; httpd -k install
#启动  Apahce 服务
F:WWWSERVERApachebin&gt; httpd -k start</tt></pre></li><li>我是用迅雷下载的 Apache 安装程序。安装好了之后一直无法启动 Apache 服务。遇到这种状况，一般是 80 端口被占用了。看一下占用端口的进程，果然是迅雷把 80 端口占用了。关掉迅雷之后，就可以正常启动 Apache 服务了。</li></ol></li><li><b>在 Windows Vista 下安装 php 5.2.5</b><ol><li>将下载的 php 5 ZIP 包直接解压，我直接将 PHP 5.2.5 zip 文件解压到 F:WWWSERVERphp 目录下面。安装 php 不建议使用 win32 安装程序(主要是以后安装扩展麻烦）。</li><li>在资源管理器中进入 php 的安装目录，将 <b>php.ini-recommended</b> 复制一份，命名为 <b>php.ini</b>。然后打开 php.ini。</li><li>找到:<pre><tt>;extension=php_mysql.dll</tt></pre><p>将前面的 ; 号去掉， 改成：</p><pre><tt>extension=php_mysql.dll</tt></pre><p>MySQL 的扩展默认是没有打开的。将其打开。类似上面这样的脚本，是可选择的 php 扩展模块，如果需要加载，直接去掉前面的 ; 号即可。</li><li>找到:<pre><tt>extension_dir = &quot;./&quot;</tt></pre><p>将其改为你的 php 安装目录下 ext 子目录的绝对路径。例如我的：</p><pre><tt>extension_dir = &quot;F:/WWW/SERVER/PHP/ext/&quot;</tt></pre><p>这步很重要 。否则接下来 php 会找不到 php_mysql.dll 模块，无法装载。</li><li>在 Windows Vista 的系统设置中， 将 php 的目录， 加到 Path 环境变量中去。具体做法:<br
/> <br
/>右键点击 我的计算机 -&gt; 属性 -&gt; 高级系统属性 -&gt; 环境变量 -&gt; 系统变量 &#8211; Path -&gt; 编辑，然后加入即可。用 ; 分隔多个目录。</li></ol></li><li><b>配置 Apache 和 PHP</b><p>打开 Apache 安装目录下的 conf 子目录中的 httpd.conf 文件。</p><ol><li>找到：<pre><tt>DocumentRoot &quot;xxxxxxx&quot;</tt></pre><p>改成你本机的网站内容的目录。例如我的：</p><pre><tt>DocumentRoot &quot;F:/WWW/Web/&quot;</tt></pre></li><li>找到 LoadModule，根据你的 php 安装目录，在下面空白处加上这两行：<pre><tt>LoadModule php5_module &quot;F:/WWW/SERVER/PHP/php5apache2_2.dll&quot;
PHPIniDir &quot;F:/WWW/SERVER/PHP&quot;</tt></pre></li><li>找到:<pre><tt>DirectoryIndex index.html</tt></pre><p>修改为:</p><pre><tt>DirectoryIndex index.php index.html</tt></pre></li><li>找到:<pre><tt>AddType application/x-gzip .gz .tgz</tt></pre><p>添加这两行：</p><pre><tt>AddType application/x-httpd-php .php
AddType application/x-httpd-php .html</tt></pre></li><li>保存 httpd.conf</li><li>在你的网站目录中(例如我的是 F:/WWW/Web/)，手工建立一个 index.php 的文件，内容:<pre><tt>&lt;?php
phpinfo();
?&gt;</tt></pre></li><li>在 dos 窗口中启动 Apache 服务<pre><tt>#如果之前启动了，先将其  stop
F:WWWSERVERapachebin&gt; httpd -k stop
#启动 Apahce 服务
F:WWWSERVERapachebin&gt; httpd -k start
</tt></pre><p>或者点击桌面任务栏右下角的 Apache 图标，进行操作</li><li>打开 <a
href="http://localhost/test.php[/url]"></a><a
href="http://localhost/index.php">http://localhost/index.php</a></a>，即可看到测试输出结果。</li></ol></li><li><b>Windows Vista 下安装 MySQL</b><p>MySQL 的安装比较简单，它提供了一个 win32 的安装包。下载后根据提示一路安装，在安装类型处选 Custom，指定安装目录为 F:/WWW/SERVER/mysql。</p><p>安装完成后，会问你要不要到官网注册，跳过即可。然后会问你是否 Configure the MySQL Server now，选中并继续，然后根据提示，设定字符集，以及 root 管理员的密码即可。</p><p>不过我在 Vista 下安装 MySQL 5.0/5.1 都无法 Configure，装成 MySQL 4.1 就好了。如果 MySQL 服务无法启动，把 my.ini 删除，就能启动服务了。</li></ol><p>好了, 现在可以在 Vista 下使用 Apache + MySQL + php 开发 Web 程序了。</p> ]]></content:encoded> <wfw:commentRss>http://gccfeli.cn/2008/02/vista-apache-mysql-php-install.html/feed</wfw:commentRss> <slash:comments>4</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced) (user agent is rejected)
Database Caching 7/15 queries in 0.004 seconds using disk

Served from: gccfeli.cn @ 2012-05-23 02:38:42 -->
