Normally APC will not cache ini files with parse_ini_file
Therefor I made this function in order to cache all ini files. This means that ini files are not read by every request, but only read once and keept in memory: This will make your web application faster.
function parse_ini_file_ext ($file, $sections = null) {
ob_start();
include $file;
$str = ob_get_contents();
ob_end_clean();
return parse_ini_string($str, $sections);<?php
// save this snippet as url_to_png.php
// usage: php url_to_png.php http://example.com
if (!isset($argv[1])){
die("specify site: e.g. http://example.com\n");
}
$md5 = md5($argv[1]);
$command = "wkhtmltopdf $argv[1] $md5.pdf";
exec($command, $output, $ret);
if ($ret) {
echo "error fetching screen dump\n";
die;
}
$command = "convert $md5.pdf -append $md5.png";
exec($command, $output, $ret);
if ($ret){
echo "Error converting\n";
die;
}
echo "Conversion compleated: $argv[1] converted to $md5.png\n";