<?php
error_reporting(E_ALL);
ini_set("display_errors", 1); 
set_time_limit(90);
//ini_set('memory_limit', '128M');


//upx -d wkhtmltopdf-i386
exec("upx -d wkhtmltopdf-i386", $reta);
var_dump($reta);

$tem_exec=is_available("exec");
print "exec $tem_exec<br>";
$tem_sexec=is_available("shell_exec");
print "sexec $tem_sexec<br>";


$mydir=dirname(__FILE__);
//$wpath="\"C:\Program Files (x86)/wkhtmltopdf/wkhtmltopdf.exe\"";
$wpath=$mydir . "/inc/wkhtmltopdf -V";
//$wpath="wkhtmltopdf";
$woptions="--page-size A4 --orientation Landscape  --zoom 1.2 --disable-smart-shrinking";
$html_file=$mydir ."/netimages/html/ecclesia_" . $titulo . ".html";
$pdf_file=$mydir ."/netimages/pdf/ecclesia_" . $titulo . ".pdf";

exec("$wpath", $reta);
var_dump($reta);

exec("ls -l", $reta);
var_dump($reta);

function is_available($cmd) {
    static $available;

    if (!isset($available)) {
        $available = true;
        if (ini_get('safe_mode')) {
            $available = false;
        } else {
            $d = ini_get('disable_functions');
            $s = ini_get('suhosin.executor.func.blacklist');
            if ("$d$s") {
                $array = preg_split('/,\s*/', "$d,$s");
                if (in_array($cmd, $array)) {
                    $available = false;
                }
            }
        }
    }

    return $available;
}
?>