Linux Archives

Tail -f apache access_log

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 […]

Using floor and time to calculate number of days elapsed from UNIX timestamp

Finding out the number of days elapsed from a UNIX timestamp is actually pretty straightforward. If you only know two dates then first you’ll need to convert the date to a UNIX timestamps and then subtract the most recent timestamp from the older timestamp like this:

<?php
$old_timestamp = 1102971600;
$elapsed_seconds = time() - $old_timestamp;
print ‘Seconds elapsed since […]

How to change the server date and time

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, […]