Updated: PHP 5.3.1 (released as of today) has fully functioning support for NTFS junctions.
The PHP Windows team finally bothered to release a new 5.3.2 snapshot after over a week of inactivity:
http://windows.php.net/snapshots/
Sadly, vBulletin 3.8.4′s inlinemod.php still manages to crash it. Stupid unstable snapshots D:
Also I’m running 5.3.2 because some idiot decided it would be smart to drop support for NTFS junctions in PHP 5.3.0 and 5.3.1, while I, like many Windows users, use them to support the www. subdomain.
And I’m running 5.3 because VC9 amongst other things makes PHP 100% faster running vBulletin 3.8 under Windows in my experience.
Download required PHP minify classes
CSS.php:
<?php
require "class.cssmin.php";
$prefix = './';
$files = array("my.css", "another.css");
$contents = '';
$size = 0;
foreach($files as $name){
$contents .= "\n\n" . file_get_contents($prefix.$name);
$size += filesize($prefix.$name);
}
$contents = "/* DarkCSSCache - 100% Pure Win. */\n".cssmin::minify($contents);
file_put_contents("../darkcsscache.css", $contents);
file_put_contents("../darkcsscache.css.gz", gzencode($contents, 9, FORCE_GZIP));
echo number_format($size)." bytes compressed to...<br />".number_format(strlen($contents))." bytes standard<br />".number_format(filesize("../darkcsscache.css.gz"))." bytes gzipped";
?>
JS.php:
<?php
require "../class.jsmin.php";
$prefix = '../';
$files = array("jquery.js", "shit.js");
$contents = '';
$size = 0;
foreach($files as $name){
$contents .= "\n\n" . file_get_contents($prefix.$name);
$size += filesize($prefix.$name);
}
$contents = "/* DarkJSCache - 100% Pure Win. */\n".JSMin::minify($contents);
file_put_contents("../darkjscache.js", $contents);
file_put_contents("../darkjscache.js.gz", gzencode($contents, 9, FORCE_GZIP));
echo number_format($size)." bytes compressed to...<br />".number_format(strlen($contents))." bytes standard<br />".number_format(filesize("../darkjscache.js.gz"))." bytes gzipped";
?>
As you might have guessed, this requires nginx with gzip_static to serve the .gz files. A much older version of DarkJSCache exists for Apache – fire me a message/comment if you are interested.
Anyway, this is by far the most efficient way to serve Javascript and CSS concatenated into a single file, minified and GZipped where the user’s browser allows.
It’s also quite unrealistic for a cron script etc. to check dates and update the files. Much better to do it yourself, so you can see changes almost instantly.
Anyway I use this on Imgkk and it’s certainly very successful there.
Nginx is a beast of a webserver so you can actually do something like this and receive replies with 0ms delay in between (unfortunately ping is a factor :< )
Also graphs coming soon, but I still find the native format useful and quite readable with it updating several times a second.
Requirements:
<html>
<head>
<script src='jquery.js'></script>
<script>
var fresh = 0;
var doIt = function(){
$.ajax({
url: "/nginx_status",
type: "GET",
dataType: "text",
success: function(data, textStatus){
lol.textContent = data;
doIt();
}
});
fresh ++;
ref.textContent = fresh;
};
</script>
</head>
<body onload="var lol = document.getElementById('lol');var ref = document.getElementById('ref');doIt()">
<pre>Nginx Live Status
By Darkimmortal
Refreshes: <span id='ref'></span>
---------------------------------------------------------------
<span id='lol'></span>---------------------------------------------------------------
</body>
</html>
Also you obviously need this in your nginx config somewhere:
location /nginx_status {
stub_status on;
access_log off;
}
Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!
I’m going to be super badass and not delete this. :3