testcached.php 906 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. require("config.inc");
  3. chdir(APP_PRIVATE_PATH . DIRECTORY_SEPARATOR . "routes" . DIRECTORY_SEPARATOR . "cachedcrc");
  4. $source = $cachedScript;
  5. $cachedSource = "cachedsource.php -- " . $source;
  6. //$phpcmdopts = "--php-ini $APP_PUBLIC_PATH/php.ini";
  7. //if (!exec("$phpExecName $source $phpcmdopts", $out)) {
  8. if (!exec("$phpExecName $source", $out1)) {
  9. echo "An hanexpected error happened!".PHP_EOL;
  10. exit(1);
  11. }
  12. //$cachedres = system("$phpExecName $cachedSource");
  13. $cachedres = exec("$phpExecName $cachedSource", $out2);
  14. foreach($out1 as $line) {
  15. echo($line)."<br>";
  16. }
  17. if (hash("sha256", trim($out1[count($out1)-1]), false) === trim($cachedres)) {
  18. echo(trim($cachedres)."<br>");
  19. echo(PHP_EOL . "good: php cache result verified." . PHP_EOL);
  20. } else {
  21. echo("<br>" . PHP_EOL . "attention, php cache result is uncoherent!" . PHP_EOL);
  22. }