<?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>PHP Extension &#8211; HU Xiaoxu</title>
	<atom:link href="https://blog.ihuxu.com/tag/php-extension/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.ihuxu.com</link>
	<description>a software engineer&#039;s blog</description>
	<lastBuildDate>Wed, 18 Jun 2025 15:26:21 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.6.2</generator>
	<item>
		<title>基于 libgit2 C 语言库的 php-git 扩展 fix bug 辛酸史</title>
		<link>https://blog.ihuxu.com/the-experience-of-the-fixing-libgit2-git-diff-tree-to-tree-bug/</link>
					<comments>https://blog.ihuxu.com/the-experience-of-the-fixing-libgit2-git-diff-tree-to-tree-bug/#comments</comments>
		
		<dc:creator><![CDATA[HU Xiaoxu]]></dc:creator>
		<pubDate>Sat, 27 Aug 2016 09:41:31 +0000</pubDate>
				<category><![CDATA[Computer Language]]></category>
		<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[Dev Problem]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[Original]]></category>
		<category><![CDATA[PHP Extension]]></category>
		<guid isPermaLink="false">http://www.ihuxu.com/blog/?p=1181</guid>

					<description><![CDATA[前言 这是一篇极其没有节（nei）操（rong）的文章。除非你真的无聊，请不要阅读，否则后果自负~ 正文 最近，在忙活微博话题组的日构建工具。工具主要的功能并不算复杂。写着写着，外面雨过天晴，居然还放起爆竹了，什么鬼。 构建工具的主要功能正如介绍中所述的那样，提取产品、测试等基本信息、提取版本库（git）信息、检查（编译）源文件、自动部署项目与发送邮件等。在提取 git 库信息时，相对于之前利用 shell_exec PHP 原生函数提取 svn 信息的方式，打算利用扩展来提取信息。一来更规范、更有效率（微乎其微），二来专业。缺点是相对而言部署环境麻烦，因为需要安装 git 扩展到当前 php 运行环境中来。 但是，万万没想到官方推荐的 php-git 扩展库开发版本已有3年没有维护了。索性用吧，又能怎样。 安装 还算顺利，由于公司开发机没有 cmake，yum 源也不可用，懒得配置，直接 download 一套源码。 上述步骤自行领会，注意上述适用于 64 位 Linux 系统，32 位的 Linux 请见上述提到的 php-git 库说明文档。 使用 我们提取的 git 信息基本也就是从上一次部署版本，到该次部署版本之间的 log 和 diff 信息。所以，第一件事情，就是拿到这段的 commit hash 值。关于下文中提到的 commit hash 和 tree hash 概念可以自行 google 或参见博客libgit2使用教程（特别篇）几个基本概念说明。 在拿到 commit hash 之后，将通过 git_diff_tree_to_tree 方法拿到每个 commit hash 之间的 diff 信息。通过方法名可以知道，这个 diff 信息是通过两个 tree 拿到的。 调用代码：<div class="read-more"><a class="btn read-more-btn" href="https://blog.ihuxu.com/the-experience-of-the-fixing-libgit2-git-diff-tree-to-tree-bug/">Read More</a></div>]]></description>
		
					<wfw:commentRss>https://blog.ihuxu.com/the-experience-of-the-fixing-libgit2-git-diff-tree-to-tree-bug/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>关于“如何开发 PHP 扩展”的学习小结</title>
		<link>https://blog.ihuxu.com/the-summary-of-the-php-extension-learing/</link>
					<comments>https://blog.ihuxu.com/the-summary-of-the-php-extension-learing/#respond</comments>
		
		<dc:creator><![CDATA[HU Xiaoxu]]></dc:creator>
		<pubDate>Tue, 08 Mar 2016 09:28:37 +0000</pubDate>
				<category><![CDATA[Computer Language]]></category>
		<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Original]]></category>
		<category><![CDATA[PHP Extension]]></category>
		<guid isPermaLink="false">http://www.ihuxu.com/blog/?p=763</guid>

					<description><![CDATA[近期，工作上的业务并不是很忙。做了大半年的业务逻辑，尽管在 PHP 编码习惯和技巧上有所进步，初步熟悉了在高并发下 Redis 和 Memcache 缓存的使用和注意事项。但，应该借此闲暇时间探索下 PHP 底层的一些原理。这样，才是会有质的提升，写出更好的代码。 正如那句话“PHP 取得成功的一个主要原因之一是她拥有大量的可用扩展”，那就从 PHP 扩展入手了解下。 在此之前，大家肯定都了解“PHP 是 C 写的”。于是打开了 PHP 的源码，列出跟目录列表如下图： PHP（5.6.4）跟目录列表 看到了熟悉的以后缀 .c 结尾的源文件。如图，有个名为“Zend”的文件夹很重要，这个就是 PHP 的核心。于是在网上搜到了两个若干 PHP 扩展的教程： http://www.laruence.com/2009/04/28/719.html http://www.walu.cc/phpbook 起初，耐心的看了 http://www.walu.cc/phpbook 的教程。并没有读完，只是看了前面的前 8 章。之后按着 http://www.laruence.com/2009/04/28/719.html 的教程，仿照着写了一个扩展。进行了编译、排查错误、编译、安装和测试等步骤，有了整体的感知。 在开发的过程中，可贵的也是难点就是要遵循 PHP 的扩展开发标准来做。我想，只要是熟悉了这个标准，至少写出一些简单的扩展是 OK 的了。在此基础上，继续深入的了解其特性，才可以开发出稳定、安全且高性能的扩展吧。 上述提到的源码（供学习交流之用）：http://github.com/genialx/geno_file]]></description>
		
					<wfw:commentRss>https://blog.ihuxu.com/the-summary-of-the-php-extension-learing/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
