<?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中文网</title>
	<atom:link href="http://www.phpzh.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.phpzh.com</link>
	<description>PHP中文网，因为专业所以权威！</description>
	<lastBuildDate>Fri, 03 Feb 2012 02:29:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>在Linux下安装配置SVN独立服务器svnserve</title>
		<link>http://www.phpzh.com/archives/591</link>
		<comments>http://www.phpzh.com/archives/591#comments</comments>
		<pubDate>Fri, 03 Feb 2012 02:00:20 +0000</pubDate>
		<dc:creator>guolb</dc:creator>
				<category><![CDATA[服务器]]></category>
		<category><![CDATA[SVN]]></category>

		<guid isPermaLink="false">http://www.phpzh.com/?p=591</guid>
		<description><![CDATA[svn服务器有两种运行方式：独立服务器svnserve和借助apache作为apache的一个模块，以webdav/deltav协议通讯。 svn存储版本数据有两种方式：BDB和FSFS。BDB方式在服务器中断时，可能锁住数据。FSFS方式更安全些，兼容性好。 /*注意当安装Berkeley DB是提供了版本库的一种存储格式，Berkeley DB是Oracle提供的一种嵌入式数据库格式，不装也不所谓，而且重要的是与Apr-util相冲突！*/ 所以如果选择安装BDB #cd db-5.3.15 /build_unix/ #../dist/configure &#8211;prefix=/usr/local/bdb #make #make install 一．安装subversion # wget http://subversion.tigris.org/downloads/subversion-1.6.13.tar.gz # wget http://subversion.tigris.org/downloads/subversion-deps-1.6.13.tar.gz # tar -xzvf subversion-1.6.13.tar.gz -C ../software/ # tar -xzvf subversion-deps-1.6.13.tar.gz -C ../software/ # cd ../software/subversion-1.6.13/ # ./configure &#8211;prefix=/usr/local/subversion-1.6.13 # make # make install # ./svnserve &#8211;version svnserve, version 1.6.13 (r1002816)    compiled Jun 1 2011, [...]]]></description>
		<wfw:commentRss>http://www.phpzh.com/archives/591/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL 5.5 分区之非整数列分区详解</title>
		<link>http://www.phpzh.com/archives/587</link>
		<comments>http://www.phpzh.com/archives/587#comments</comments>
		<pubDate>Thu, 05 Jan 2012 08:55:20 +0000</pubDate>
		<dc:creator>guolb</dc:creator>
				<category><![CDATA[数据库]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.phpzh.com/?p=587</guid>
		<description><![CDATA[　非整数列分区 　　任何使用过分区的人应该都遇到过不少问题，特别是面对非整数列分区时，MySQL 5.1只能处理整数列分区，如果你想在日期或字符串列上进行分区，你不得不使用函数对其进行转换。 　　MySQL 5.5中新增了两类分区方法，RANG和LIST分区法，同时在新的函数中增加了一个COLUMNS关键词。我们假设有这样一个表：   以下是代码片段： CREATE TABLE expenses ( expense_date DATE NOT NULL, category VARCHAR(30), amount DECIMAL (10,3) );   　　如果你想使用MySQL 5.1中的分区类型，那你必须将类型转换成整数，需要使用一个额外的查找表，到了MySQL 5.5中，你可以不用再进行类型转换了，如： 以下是代码片段： ALTER TABLE expenses PARTITION BY LIST COLUMNS (category) ( PARTITION p01 VALUES IN ( &#8216;lodging&#8217;, &#8216;food&#8217;), PARTITION p02 VALUES IN ( &#8216;flights&#8217;, &#8216;ground transportation&#8217;), PARTITION p03 VALUES IN ( [...]]]></description>
		<wfw:commentRss>http://www.phpzh.com/archives/587/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL 5.1 分区技术初探（二）</title>
		<link>http://www.phpzh.com/archives/576</link>
		<comments>http://www.phpzh.com/archives/576#comments</comments>
		<pubDate>Fri, 30 Dec 2011 09:52:20 +0000</pubDate>
		<dc:creator>guolb</dc:creator>
				<category><![CDATA[数据库]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.phpzh.com/?p=576</guid>
		<description><![CDATA[　　MySQL分区技术是用来减轻海量数据带来的负担，解决数据库性能下降问题的一种方式，其他的方式还有建立索引，大表拆小表等等。 　　MySQL分区按照分区的参考方式来分有RANGE分区、LIST分区、HASH分区、KEY分区。本文对这几种分区方式进行了详细的介绍，并且给出了简单的示例，文章简洁明了，对于想要初步了解MySQL分区技术的同学来说是很不错的参考材料。 三、案例分析 　　这个案例是针对有个员工、部门、部门经理、头衔和销售记录的模拟数据，其ER图如下所示，数据量大概有4百万左右。数据下载URL：https://launchpad.net/test-db 　　 图11，案例分析 　　通过如上可知，对于同样的数据按照分区和不分区的技术分别存储，从而便于如下的查询性能分析和对比。对于salaries表，它采用RANGE分区，定义如下： 　　 图12，案例分析 　　1，单表查询 　　从销售记录中找到1999年整年的销售记录有多少条，这个很简单，查询语句如下： 　　select count(*) from salaries s where s.from_date between”1999-01-01&#8243; and “1999-12-31&#8243; ; 　　那么对于分区前后的查询性能却有很大的差别： 　　 图13，分区前后查询性能对比 　　通过如上可知，利用分区之后它只需扫描p16分区，访问的记录明显减少，所以性能自然有较大的提升： 图14，无采用分区技术和采用分区技术性能对比 　　2，单表查询的badcase 　　若现在有如下查询： 　　select count(*) from salaries s where year(s.from_date)=1999; 　　那么它是否能够利用到分区技术呢，答案是否定的。为什么呢，因为分区中的key是s.from_date，而不是year(s.from_date)，mysql并不能很智能地判断year是1999的，那么它就是分为p16分区，这个可以通过如下的查询计划可以证实： 　　 图15，未优化前的单表查询 　　也就是其实它访问了所有的分区，所以并没有很好地利用分区功能，将SQL改写如下： 　　select count(*) from salaries s where year between &#8217;1999-01-01&#8242; and&#8217;1999-12-31&#8242; ; 　　则查询计划如下： 图16，改进后的单表查询 　　可知，书写正确的SQL可以完全表现出两种相差特别大的性能。]]></description>
		<wfw:commentRss>http://www.phpzh.com/archives/576/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL 5.1 分区技术初探(一)</title>
		<link>http://www.phpzh.com/archives/560</link>
		<comments>http://www.phpzh.com/archives/560#comments</comments>
		<pubDate>Fri, 30 Dec 2011 09:49:07 +0000</pubDate>
		<dc:creator>guolb</dc:creator>
				<category><![CDATA[数据库]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.phpzh.com/?p=560</guid>
		<description><![CDATA[　MySQL分区技术是用来减轻海量数据带来的负担，解决数据库性能下降问题的一种方式，其他的方式还有建立索引，大表拆小表等等。 　　MySQL分区按照分区的参考方式来分有RANGE分区、LIST分区、HASH分区、KEY分区。本文对这几种分区方式进行了详细的介绍，并且给出了简单的示例，文章简洁明了，对于想要初步了解MySQL分区技术的同学来说是很不错的参考材料。    一、背景介绍 　　当 MySQL中一个表的总记录数超过了1000万，会出现性能的大幅度下降吗？答案是肯定的。但性能下降的比率由系统的架构、应用程序、数据库索引、服务器硬件等多种因素而定。数据库多达上亿的数据量，分表之后的单个表也已经突破千万，那么单个表的更新等均影响着系统的运行效率。甚至是一条简单的SQL都有可能压垮整个数据库，如整个表对某个字段的排序操作等。 　　目前，针对海量数据的优化主要有2种方法：大表拆小表的方式、SQL语句的优化。 　　SQL语句的优化：可以通过增加索引等来调整，但是数据量的增大将会导致索引的维护代价增大。在此不详述，建议大家参考相应的《High Performance MySQL》等书籍。 　　大表拆小表的方式主要有两种： 　　1，垂直分表： 　　 　　　　图1，垂直分区示意图 　　对于垂直分表，它将一个N1+N2个字段的表Tab拆分成N1字段的子表Tab1和(N2+1)字段的子表Tab2；其中子表Tab2包含了关于子表Tab1的主键信息，否则两个表的关联关系就会丢失。当然垂直分表会带来程序端SQL的修改，若是应用程序已经应用很长的一段时间，然后程序的升级将是耗时而且易出错的，即升级的代价将会很大。 　　2，水平分表： 　　 　　　　图2，水平分区示意图 　　水平分区技术将一个表拆成多个表，比较常用的方式是将表中的记录按照某种Hash算法进行拆分，简单的拆分方法如取模方式。同样，这种分区方法也必须对前端的应用程序中的SQL进行修改方可使用。而且对于一个SQL，它可能会修改两个表，那么你必须得写成2个SQL语句从而可以完成一个逻辑的事务，使得程序的判断逻辑越来越复杂，这样也会导致程序的维护代价高，也就失去了采用数据库的优势。因此，分区技术可以有力地避免如上的弊端，成为解决海量数据存储的有力方法。 二、MySQL分区介绍 　　MySQL的分区技术不同与之前的分表技术，它与水平分表有点类似，但是它是在逻辑层进行的水平分表，对与应用程序而言它还是一张表。MySQL5.1有5种分区类型： 　　RANGE分区：基于属于一个给定连续区间的列值，把多行分配给分区； 　　LIST分区：类似于按RANGE分区，区别在于LIST分区是基于列值匹配一个离散值集合中的某个值来进行选择； 　　HASH分区：基于用户定义的表达式的返回值来进行选择的分区，该表达式使用将要插入到表中的这些行的列值进行计算。这个函数可以包含MySQL中有效的、产生非负整数值的任何表达式； 　　KEY分区：类似于按HASH分区，区别在于KEY分区只支持计算一列或多列，且MySQL服务器提供其自身的哈希函数。 　　1，RANGE分区 　　对于RANGE分区，举个例子： 　　例1：假定你创建了一个如下的表，该表保存有20家音像店的职员记录，这20家音像店的编号从1到20。如果你想将其分成4个小分区，那么你可以采用RANGE分区，创建的数据库表如下： 　　 　　　　图3，RANGE分区实例1 　　在这个例子，key是一个整型的数据，那是否对于其它类型的字段就无法作为key呢？答案是否定的，例子2说明这种情况。 　　例2：假定你创建了一个如下的表，该表保存有20家音像店的职员记录，这20家音像店的编号从1到20。你想把不同时期离职的员工进行分别存储，那么你可以将日期字段separated（即离职时间）作为一个key，创建的SQL语句如下： 　　 　　　　图4，RANGE分区实例2 　　这样你就可以对一个日期类型的字段调用mysql的日期函数YEAR()转换为一种整数类型，从而可以作为RANGE分区的key。这个时候你可以看到，分区后的物理文件是相对独立的：  　　 　　　　图5，RANGE分区后物理文件 　　可知，每个分区有自己独立的数据文件和索引文件，这是为什么你对某一个查询，它只会访问它需要访问的数据块，而不访问根本不是结果的物理块，从而可以大大提高系统的效率。]]></description>
		<wfw:commentRss>http://www.phpzh.com/archives/560/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP 利用uniqid() 函数生成唯一值</title>
		<link>http://www.phpzh.com/archives/559</link>
		<comments>http://www.phpzh.com/archives/559#comments</comments>
		<pubDate>Tue, 27 Dec 2011 02:16:36 +0000</pubDate>
		<dc:creator>guolb</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP技巧]]></category>

		<guid isPermaLink="false">http://www.phpzh.com/?p=559</guid>
		<description><![CDATA[定义和用法 uniqid() 函数基于以微秒计的当前时间，生成一个唯一的 ID。 语法 uniqid(prefix,more_entropy) 参数 描述 prefix 可选。为 ID 规定前缀。如果两个脚本在相同的微妙生成 ID，该参数很有用。 more_entropy 可选。规定位于返回值末尾的更多的熵。 说明 如果 prefix 参数为空，则返回的字符串有 13 个字符串长。如果 more_entropy 参数设置为 true，则是 23 个字符串长。 如果 more_entropy 参数设置为 true，则在返回值的末尾添加额外的熵（使用组合线形同余数生成程序），这样可以结果的唯一性更好。 返回值 以字符串的形式返回唯一标识符。 提示和注释 注释：由于基于系统时间，通过该函数生成的 ID 不是最佳的。如需生成绝对唯一的 ID，请使用 md5() 函数（请在字符串函数参考中查找）。 例子 &#60;?php echo uniqid(); ?&#62; 输出类似： 4415297e3af8c]]></description>
		<wfw:commentRss>http://www.phpzh.com/archives/559/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LNMP包之nginx如何设置404错误页面</title>
		<link>http://www.phpzh.com/archives/558</link>
		<comments>http://www.phpzh.com/archives/558#comments</comments>
		<pubDate>Thu, 03 Nov 2011 01:15:45 +0000</pubDate>
		<dc:creator>guolb</dc:creator>
				<category><![CDATA[服务器]]></category>
		<category><![CDATA[nginx]]></category>

		<guid isPermaLink="false">http://www.phpzh.com/?p=558</guid>
		<description><![CDATA[1.创建自己的404.html页面 2.更改nginx.conf在http定义区域加入：astcgi_intercept_errors on; 3.更改nginx.conf或虚拟主机的域名.conf在server 区域加入：error_page 404 /404.html; 注意事项： 1.必须要添加：fastcgi_intercept_errors on; 如果这个选项没有设置，即使创建了404.html和配置了error_page也没有效果。 2.不要出于省事或者提高首页权重的目的将首页指定为404错误页面，也不要用其它方法跳转到首页。 3.自定义的404页面必须大于512字节，否则可能会出现IE默认的404页面。例如，假设自定义了404.html,大小只有11个字节（内容为：404错误）。 4.测试nginx.conf正确性：/usr/local/nginx/sbin/nginx -t 如果正确应该显示如下信息： the configuration file /opt/nginx/conf/nginx.conf syntax is ok configuration file /opt/nginx/conf/nginx.conf test is successful 5.重启nginx kill -HUP  `cat /opt/nginx/nginx.pid `]]></description>
		<wfw:commentRss>http://www.phpzh.com/archives/558/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>lnmp之安装PHP模块(不需要重装PHP)</title>
		<link>http://www.phpzh.com/archives/551</link>
		<comments>http://www.phpzh.com/archives/551#comments</comments>
		<pubDate>Thu, 03 Nov 2011 01:10:35 +0000</pubDate>
		<dc:creator>guolb</dc:creator>
				<category><![CDATA[服务器]]></category>
		<category><![CDATA[nginx]]></category>

		<guid isPermaLink="false">http://www.phpzh.com/?p=551</guid>
		<description><![CDATA[本文以imap和exif模块为例。 一、安装imap模块 1、安装imap模块前需要先安装imap所需的库： CentOS ：yum install libc-client-devel Debian：apt-get install libc-client-dev 2、首先进入php安装目录的ext目录 比如php的安装目录为：/root/lnmp0.4-full/php-5.2.10/ 则执行：cd /root/lnmp0.4-full/php-5.2.10/ext/ 我们要安装imap模块，执行cd imap/ 再执行 /usr/local/php/bin/phpize 会返回如下信息： Configuring for: PHP Api Version:         20041225 Zend Module Api No:      20060613 Zend Extension Api No:   220060519 再执行以下命令： [root@vpser imap]# ./configure &#8211;with-php-config=/usr/local/php/bin/php-config [root@vpser imap]# make &#38;&#38; make install 执行完返回： Build complete. Don&#8217;t forget to run &#8216;make test&#8217;. [...]]]></description>
		<wfw:commentRss>http://www.phpzh.com/archives/551/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>lnmp一键安装包常见问题处理</title>
		<link>http://www.phpzh.com/archives/550</link>
		<comments>http://www.phpzh.com/archives/550#comments</comments>
		<pubDate>Thu, 03 Nov 2011 01:07:52 +0000</pubDate>
		<dc:creator>guolb</dc:creator>
				<category><![CDATA[服务器]]></category>
		<category><![CDATA[nginx]]></category>

		<guid isPermaLink="false">http://www.phpzh.com/?p=550</guid>
		<description><![CDATA[lnmp一键安装包删除添加的域名 如果使用lnmp一键安装包/root/vhost.sh 添加的域名可以，可以删除/usr/local/nginx/conf/vhost/要删除的域名.conf 文件，在/root/lnmp restart 即可。如果是自己手动在/usr/local/nginx/conf/nginx.conf 里添加的，直接删除其中域名 的server{}段就可以了，记得重启。 lnmp一键安装包忘记数据库密码 执行如下命令：wget http://soft.vpser.net/lnmp/ext/reset-mysql-root-password.phps;php reset-mysql-root-password.phps 新密码 [Warning] &#8216;&#8211;skip-locking&#8217; is deprecated and will be removed in a future release. Please use &#8216;&#8211;skip-external-locking&#8217; instead. 错误提示： 101009 15:40:10 mysqld_safe Starting mysqld daemon with databases from /var/db/mysql 101009 15:40:10 [Warning] &#8216;&#8211;skip-locking&#8217; is deprecated and will be removed in a future release. Please [...]]]></description>
		<wfw:commentRss>http://www.phpzh.com/archives/550/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LNMP一键安装包解决502 Bad Gateway错误</title>
		<link>http://www.phpzh.com/archives/549</link>
		<comments>http://www.phpzh.com/archives/549#comments</comments>
		<pubDate>Thu, 03 Nov 2011 01:06:35 +0000</pubDate>
		<dc:creator>guolb</dc:creator>
				<category><![CDATA[服务器]]></category>
		<category><![CDATA[nginx]]></category>

		<guid isPermaLink="false">http://www.phpzh.com/?p=549</guid>
		<description><![CDATA[关于lnmp一键安装包的nginx 502 Bad Gateway错误 第一种原因：目前lnmp一键安装包比较多的问题就是502 Bad Gateway，大部分情况下原因是在安装php前，脚本中某些lib包可能没有安装上，造成php没有编译安装成功。 解决方法： 可以尝试根据lnmp一键安装包中的脚本手动安装一下，看看是什么错误导致的，在网上搜索一下，或者把错误信息发上来。我们给你分析一下错误原因。 第二种原因： 在php.ini里，eaccelerator配置项一定要放在Zend Optimizer配置之前，否则也可能引起502 Bad Gateway 第三种原因： 在安装好使用过程中出现502问题，一般是因为默认php-cgi进程是5个，可能因为phpcgi进程不够用而造成502，需要修改/usr/local/php/etc/php-fpm.conf 将其中的max_children值适当增加。 也有可能是max_requests值不够用。 第四种原因： php执行超时，修改/usr/local/php/etc/php.ini 将max_execution_time 改为300 第五种原因： 磁盘空间不足，如mysql日志占用大量空间 第六种原因： 查看php-cgi进程是否在运行]]></description>
		<wfw:commentRss>http://www.phpzh.com/archives/549/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>安装lnmp前请先运行screen</title>
		<link>http://www.phpzh.com/archives/548</link>
		<comments>http://www.phpzh.com/archives/548#comments</comments>
		<pubDate>Thu, 13 Oct 2011 08:09:32 +0000</pubDate>
		<dc:creator>guolb</dc:creator>
				<category><![CDATA[服务器]]></category>
		<category><![CDATA[nginx]]></category>

		<guid isPermaLink="false">http://www.phpzh.com/?p=548</guid>
		<description><![CDATA[网络突然掉线或者不小心putty被关掉等等原因，造成lnmp安装过程被中断怎么办，其实防止这种现象很简单，只要在安装lnmp前执行screen命令就可以了。 licess也在vps侦探上说过screen命令的使用方法，下面结合lnmp的安装过程再说一下。 1、screen安装方法就不说了，看vps侦探上的文章吧 2、执行：screen -S lnmp 创建screen会话。 2、执行：wget -c http://soft.vpser.net/lnmp/lnmp0.5-full.tar.gz 下载安装包。 3、执行：tar zxvf lnmp0.5-full.tar.gz 解压。 4、执行：cd lnmp0.5-full/ 进入lnmp0.5目录。 5、Centos执行：./centos.sh ,Debian 执行：./debian.sh 进行安装。 如果网络掉线，可以重新连接，再执行 screen -r lnmp 就会看到你的lnmp安装进程。]]></description>
		<wfw:commentRss>http://www.phpzh.com/archives/548/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

