<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.2.3" -->
<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/"
	>

<channel>
	<title>PHP-Scripts Blog &#187; Linux</title>
	<link>http://www.php-scripts.com</link>
	<description>Writing about PHP scripting since 12/99. Learn something new every day.</description>
	<pubDate>Thu, 09 Oct 2008 14:17:07 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.3</generator>
	<language>en</language>
			<item>
		<title>Tail -f apache access_log</title>
		<link>http://www.php-scripts.com/20051023/43/</link>
		<comments>http://www.php-scripts.com/20051023/43/#comments</comments>
		<pubDate>Sun, 23 Oct 2005 13:19:17 +0000</pubDate>
		<dc:creator>TDavid</dc:creator>
		
		<category><![CDATA[SSH]]></category>

		<category><![CDATA[Linux]]></category>

		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.php-scripts.com/?p=43</guid>
		<description><![CDATA[
Here is how to use SSH/Telnet do a search and locate your access_log file. The linux locate command will help:

locate access_log

You might see lots of logs separated by domain names. A common location for these logs are /var/log/apache, so cd your way there:

cd /var/log/apache
/var/log/apache$ tail -f access_log

Now a stream using tail of the file will [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.php-scripts.com/images/2005/tail-f_ssh.jpg" border="0" ALT="SSH screenshot showing tail -f stream in action"/></p>
<p>Here is how to use SSH/Telnet do a search and locate your access_log file. The linux locate command will help:</p>
<div class="codesnip-container" >
<div class="codesnip">locate access_log</div>
</div>
<p>You might see lots of logs separated by domain names. A common location for these logs are /var/log/apache, so cd your way there:</p>
<div class="codesnip-container" >
<div class="codesnip">cd /var/log/apache<br />
/var/log/apache$ tail -f access_log</div>
</div>
<p>Now a stream using tail of the file will occur in real time and you can watch and see who is accessing what in near real time.</p>
<p>Reference: <a href="http://www.php-scripts.com/php_diary/012103.php3">Parsing Apache acces log files using PHP</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.php-scripts.com/20051023/43/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Using floor and time to calculate number of days elapsed from UNIX timestamp</title>
		<link>http://www.php-scripts.com/20050921/23/</link>
		<comments>http://www.php-scripts.com/20050921/23/#comments</comments>
		<pubDate>Wed, 21 Sep 2005 20:06:51 +0000</pubDate>
		<dc:creator>TDavid</dc:creator>
		
		<category><![CDATA[Linux]]></category>

		<category><![CDATA[PHP 5.x]]></category>

		<category><![CDATA[PHP 4.x]]></category>

		<category><![CDATA[PHP 3.x]]></category>

		<category><![CDATA[Information]]></category>

		<guid isPermaLink="false">http://www.php-scripts.com/?p=23</guid>
		<description><![CDATA[Finding out the number of days elapsed from a UNIX timestamp is actually pretty straightforward. If you only know two dates then first you&#8217;ll need to convert the date to a UNIX timestamps and then subtract the most recent timestamp from the older timestamp like this:

&#60;?php
$old_timestamp = 1102971600;
$elapsed_seconds = time&#40;&#41; - $old_timestamp;
print &#8216;Seconds elapsed since [...]]]></description>
			<content:encoded><![CDATA[<p>Finding out the number of days elapsed from a UNIX timestamp is actually pretty straightforward. If you only know two dates then first you&#8217;ll need to convert the date to a UNIX timestamps and then subtract the most recent timestamp from the older timestamp like this:</p>
<div class="codesnip-container" >
<div class="codesnip">&lt;?php<br />
<span class="re0">$old_timestamp</span> = <span class="nu0">1102971600</span>;<br />
<span class="re0">$elapsed_seconds</span> = <a href="http://www.php.net/time"><span class="kw3">time</span></a><span class="br0">&#40;</span><span class="br0">&#41;</span> - <span class="re0">$old_timestamp</span>;<br />
<a href="http://www.php.net/print"><span class="kw3">print</span></a> <span class="st0">&#8216;Seconds elapsed since &#8216;</span> . <a href="http://www.php.net/date"><span class="kw3">date</span></a><span class="br0">&#40;</span><span class="st0">&#8220;m-d-Y H:i:s&#8221;</span>,<span class="re0">$old_timestamp</span><span class="br0">&#41;</span> . <span class="st0">&#8220;: &lt;b&gt;$elapsed_seconds&#8221;</span>;<br />
<span class="kw2">?&gt;</span></div>
</div>
<p>Now, let&#8217;s convert those seconds to days using the floor() function, by just adding the following code to the code above:</p>
<div class="codesnip-container" >
<div class="codesnip"><span class="coMULTI">/*<br />
divide #seconds by 60 for minutes<br />
divide #of minutes by 60 for hours<br />
divide #of hours by 24 for days<br />
use floor to get integer for day<br />
*/</span><br />
<span class="re0">$elapsed_days</span> = <a href="http://www.php.net/floor"><span class="kw3">floor</span></a><span class="br0">&#40;</span><span class="br0">&#40;</span><span class="re0">$elapsed_seconds</span> / <span class="nu0">60</span><span class="br0">&#41;</span> / <span class="nu0">60</span> / <span class="nu0">24</span><span class="br0">&#41;</span>; <br />
<a href="http://www.php.net/print"><span class="kw3">print</span></a> <span class="st0">&#8220;&lt;br /&gt;Number of days elapsed: $elapsed_days&#8221;</span>;</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.php-scripts.com/20050921/23/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How to change the server date and time</title>
		<link>http://www.php-scripts.com/20050915/15/</link>
		<comments>http://www.php-scripts.com/20050915/15/#comments</comments>
		<pubDate>Thu, 15 Sep 2005 19:50:51 +0000</pubDate>
		<dc:creator>TDavid</dc:creator>
		
		<category><![CDATA[Linux]]></category>

		<category><![CDATA[Installation and configuration]]></category>

		<guid isPermaLink="false">http://www.php-scripts.com/?p=15</guid>
		<description><![CDATA[This is more a Linux task than a PHP one, but for those needing to change their server date/time, it can be done with the linux DATE command as follows:

date - s `+ 1500`

This might require root or sudo privileges. In that case the command would be:

sudo date - s `+ 1500`

On a PHP note, [...]]]></description>
			<content:encoded><![CDATA[<p>This is more a Linux task than a PHP one, but for those needing to change their server date/time, it can be done with the linux DATE command as follows:</p>
<div class="codesnip-container" >
<div class="codesnip">date - s `+ 1500`</div>
</div>
<p>This might require root or sudo privileges. In that case the command would be:</p>
<div class="codesnip-container" >
<div class="codesnip">sudo date - s `+ 1500`</div>
</div>
<p>On a PHP note, I broke down ways to <a href="http://www.php-scripts.com/php_diary/121799.html">work with the PHP date() function</a> in my php-scripts diary on 12/17/1999. It doesn&#8217;t seem like that long ago, but it was nearly <i>six years ago!</i></p>
]]></content:encoded>
			<wfw:commentRss>http://www.php-scripts.com/20050915/15/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
