rc.php_test_run 681 Bytes
Newer Older
1
#!/usr/local/bin/php
2 3 4 5 6 7 8 9 10 11 12 13
<?php

/*
     This script will chroot via the builder system to test
     the local php setup.  If we can perform a series of
     small tests to ensure the php environment is sane.
*/

require_once('util.inc');
require_once('xmlparse.inc');
require_once('config.lib.inc');

14
$config = parse_config();
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36

$passed_tests = true;

// Test config.inc
if ($config['system']['hostname'] == '') {
	$passed_tests = false;
}

// Test for php-fcgi
$php_cgi = trim(`php-cgi -v | grep cgi-fcgi`);
if (stristr($php_cgi, 'cgi-fcgi')) {
	echo 'FCGI-PASSED ';
} else {
	echo 'FCGI-FAILED ';
	exit(1);
}

if ($passed_tests) {
	echo 'PASSED';
	exit(0);
}

37
echo 'FAILED';
38
exit(1);