Fixing timezones the easy way
- October 25th, 2007
- No Comments
- php
', $eol;
}
echo 'PHP Version: ', $ve, $eol;
echo 'PHP OS: ', $os, $eol;
echo 'Error Reporting: ', $er, $eol;
foreach ($flags as $n => $v)
{
echo $n, ': ', $v, $eol;
}
echo 'Loaded Extensions:', $eol, $le, $eol; By default the apache configuration cuts the filenames to a certain value. The following directive allows the full file name to be shown in the directory listing of a virtual host.
Adding this line to the directory section of your virtual host will allow apache to show the full length filenames in the directory list. Be sure that the option Indexes is also set
IndexOptions NameWidth=*
This function will return the current time in seconds and microseconds. This is sometimes useful to track down the processing time of a script or other short lasting events.
function microtime_float()
{
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
An example usage could look like this:
$start = microtime_float();
// your code here
$took = round(microtime_float() - $start, 2);
echo "took $took seconds.";
Sometimes its useful to send a small reminder, note or even a whole file from the commandline in linux. This is how it goes.
To send just a simple message type:
echo "e-mail body" | mail -s "e-mail subject" mail@example.com
If you want to send a file type:
echo "e-mail body" | mail -a /full/path/to/file -s "e-mail subject" mail@example.com
Developers using subversion as version control system might have encountered that it is possible to browse through the .svn directories in their checked out repositories. Of course this can cause some security related problems as sources can be spied out. This little apache configuration allows restricting this behaviour.
<directorymatch \.svn>
Order allow,deny
Deny from all
</directorymatch>
It is also possible to put the following statement to a .htaccess file to have a similar effect.
RewriteEngine on
RewriteRule .*\.svn.* http://%{SERVER_NAME}/