<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></title> 
<link>http://jackxiang.com/index.php</link> 
<description><![CDATA[赢在IT，Playin' with IT,Focus on Killer Application,Marketing Meets Technology.]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></copyright>
<item>
<link>http://jackxiang.com/post//</link>
<title><![CDATA[PHP.INI settings: Disable exec, shell_exec, system, popen and Other Functions To Improve Security，禁用php某些函数]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[Php/Js/Shell/Go]]></category>
<pubDate>Thu, 31 Dec 2009 13:06:12 +0000</pubDate> 
<guid>http://jackxiang.com/post//</guid> 
<description>
<![CDATA[ 
	<textarea name="code" class="php" rows="15" cols="100">echo exec(&#039;whoami&#039;);&nbsp;&nbsp;//这个函数较危险，一般禁用，在php.ini里可打开。</textarea><br/>date测试的时候容易出现如下情况，data-s 查询了下，可以实现如下，<br/><div class="code">date -s &quot;2010-1-1 16:11:21&quot;</div><br/>但是其他同事也用到date(&quot;Y-m-d H:i:s&quot;),就会说：我在调试c程序，是谁修改了服务器时间？我说：我在测试。<br/>于是就有人说没有必要通过date -s来修改整个服务器的时间，而是重写php的该date函数，但是我一旦重写，会提示错误的。<br/>于是又有人说可以关闭掉，date()函数，于是查了下国外的，如下：<br/><br/>Q. I run a small Apache based webserver for my personal use and it is shared with friends and family. However, most script kiddie try to exploit php application such as wordpress using exec() , passthru() , shell_exec() , system() etc functions. How do I disable these functions to improve my php script security?<br/><br/>A. PHP has a lot of functions which can be used to crack your server if not used properly. You can set list of functions in php.ini using disable_functions directive. This directive allows you to disable certain functions for security reasons. It takes on a comma-delimited list of function names. disable_functions is not affected by Safe Mode. This directive must be set in php.ini For example, you cannot set this in httpd.conf.<br/><br/><br/><div class="code">Open php.ini file:<br/># vi /etc/php.ini<br/>Find disable_functions and set new list as follows:<br/>disable_functions =exec,passthru,shell_exec,system,proc_open,popen,curl_exec,curl_multi_exec,parse_ini_file,show_source !<br/><br/>Save and close the file. Restart httpd:<br/># service httpd restart</div><br/><br/><br/><div class="code">Warning: date() has been disabled for security reasons in&nbsp;&nbsp;/*/*/datetest.php on line 5</div><br/><br/><br/><div class="code">&lt;?php<br/>function date($str)<br/>&#123;<br/><br/>return &quot;2009-12-11 21:09:35&quot;;<br/>&#125;<br/>echo date(&quot;Y-m-d H:i:s&quot;);<br/><br/>?&gt;</div><br/>出现：<br/>[/usr/local/tads/htdocs/qdkj/src/view]# php datetest.php <br/><br/>Fatal error: Cannot redeclare date() in /data/*/*/src/view/datetest.php on line 6<br/>I think:<br/>PHP already has a date() function and you cannot overwrite existing functions in this language. Rename your function and it will work. Or wrap it in a class and it will work as well.<br/><br/><br/>于是，我在想啊，现在如果有人在用php的date,我给大家把这个date函数给disable了，大家回不会来找我呢？拭目以待。。。<br/><br/>EOF
]]>
</description>
</item><item>
<link>http://jackxiang.com/post//#blogcomment</link>
<title><![CDATA[[评论] PHP.INI settings: Disable exec, shell_exec, system, popen and Other Functions To Improve Security，禁用php某些函数]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://jackxiang.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>