<?php
if (isset($_GET['logopng']))
{
	$data='[encoded data, 8620 characters]';
	header('Content-type: image/png');
	echo base64_decode($data);
	exit;
}
else if (isset($_GET['background']))
{
	$data='[encoded data, 6048 characters]';
	header('Content-type: image/gif');
	echo base64_decode($data);
	exit;
}

// Required
$php_ok = (function_exists('version_compare') && version_compare(phpversion(), '5.2.0', '>='));
$simplexml_ok = extension_loaded('simplexml');
$json_ok = (extension_loaded('json') && function_exists('json_encode') && function_exists('json_decode'));
$spl_ok = extension_loaded('spl');
$pcre_ok = extension_loaded('pcre');
if (function_exists('curl_version'))
{
	$curl_version = curl_version();
	$curl_ok = (function_exists('curl_exec') && in_array('https', $curl_version['protocols'], true));
}
$file_ok = (function_exists('file_get_contents') && function_exists('file_put_contents'));

// Optional, but recommended
$openssl_ok = (extension_loaded('openssl') && function_exists('openssl_sign'));
$zlib_ok = extension_loaded('zlib');

// Optional
$apc_ok = extension_loaded('apc');
$xcache_ok = extension_loaded('xcache');
$memcached_ok = extension_loaded('memcached');
$memcache_ok = extension_loaded('memcache');
$mc_ok = ($memcache_ok || $memcached_ok);
$pdo_ok = extension_loaded('pdo');
$pdo_sqlite_ok = extension_loaded('pdo_sqlite');
$sqlite2_ok = extension_loaded('sqlite');
$sqlite3_ok = extension_loaded('sqlite3');
$sqlite_ok = ($pdo_ok && $pdo_sqlite_ok && ($sqlite2_ok || $sqlite3_ok));

header('Content-type: text/html; charset=UTF-8');

?><!DOCTYPE html>

<html lang="en">
<head>
<title>AWS SDK for PHP: Environment Compatibility Test</title>

<style type="text/css">
body {
	font:14px/1.4em "Helvetica Neue", Helvetica, "Lucida Grande", Verdana, Arial, Clean, Sans, sans-serif;
	letter-spacing:0px;
	color:#333;
	margin:0;
	padding:0;
	background:#fff url(<?php echo pathinfo(__FILE__, PATHINFO_BASENAME); ?>?background) repeat-x top left;
}

div#site {
	width:650px;
	margin:20px auto 0 auto;
}

a {
	color: #326EA1;
	text-decoration: underline;
	padding: 1px 2px;
	-webkit-transition: background-color 0.15s;
	-webkit-transition: color 0.15s;
	-moz-transition: background-color 0.15s;
	-moz-transition: color 0.15s;
	transition: background-color 0.15s;
	transition: color 0.15s;
	-webkit-border-radius: 2px;
	-moz-border-radius: 2px;
	border-radius: 2px;
}

a:hover, a.hover {
	color: #fff;
	background-color: #333;
	text-decoration: none;
	padding: 1px 2px;
}

p {
	margin:0;
	padding:5px 0;
}

em {
	font-style:normal;
	background-color:#ffc;
}

ul, ol {
	margin:10px 0 10px 20px;
	padding:0 0 0 15px;
}

ul li, ol li {
	margin:0 0 4px 0;
	padding:0 0 0 3px;
}

h2 {
	font-size:18px;
	padding:0;
	margin:0 0 10px 0;
}

h3 {
	font-size:16px;
	padding:0;
	margin:20px 0 5px 0;
}

h4 {
	font-size:14px;
	padding:0;
	margin:15px 0 5px 0;
}

code {
	font-size:1.1em;
	background-color:#f3f3ff;
	color:#000;
}

em strong {
    text-transform: uppercase;
}

table#chart {
	border-collapse:collapse;
}

table#chart th {
	background-color:#eee;
	padding:2px 3px;
	border:1px solid #fff;
}

table#chart td {
	text-align:center;
	padding:2px 3px;
	border:1px solid #eee;
}

table#chart tr.enabled td {
	/* Leave this alone */
}

table#chart tr.disabled td,
table#chart tr.disabled td a {
	color:#999;
	font-style:italic;
}

table#chart tr.disabled td a {
	text-decoration:underline;
}

div.chunk {
	margin:0;
	padding:10px;
	border-bottom:1px solid #ccc;
}

div.important {
	background-color:#ffc;
}

div.ok {
	background-color:#cfc;
}

div.error {
	background-color:#fcc;
}

div.important h3 {
	margin: 7px 0 5px 0;
}

.footnote,
.footnote a {
	font:12px/1.4em "Helvetica Neue", Helvetica, "Lucida Grande", Verdana, Arial, Clean, Sans, sans-serif;
	color:#aaa;
}

.footnote em {
	background-color:transparent;
	font-style:italic;
}
</style>

<script type="text/javascript">
// Sleight - Alpha transparency PNG's in Internet Explorer 5.5/6.0
// (c) 2001, Aaron Boodman; http://www.youngpup.net

if (navigator.platform == "Win32" && navigator.appName == "Microsoft Internet Explorer" && window.attachEvent) {
	document.writeln('<style type="text/css">img, input.image { visibility:hidden; } </style>');
	window.attachEvent("onload", fnLoadPngs);
}

function fnLoadPngs() {
	var rslt = navigator.appVersion.match(/MSIE (\d+\.\d+)/, '');
	var itsAllGood = (rslt != null && Number(rslt[1]) >= 5.5);

	for (var i = document.images.length - 1, img = null; (img = document.images[i]); i--) {
		if (itsAllGood && img.src.match(/\png$/i) != null) {
			var src = img.src;
			var div = document.createElement("DIV");
			div.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizing='scale')";
			div.style.width = img.width + "px";
			div.style.height = img.height + "px";
			img.replaceNode(div);
		}
		img.style.visibility = "visible";
	}
}
</script>

</head>

<body>

<div id="site">
	<div id="content">

		<div class="chunk">
			<h2 style="text-align:center;"><img src="<?php echo pathinfo(__FILE__, PATHINFO_BASENAME); ?>?logopng" alt="SimplePie Compatibility Test" title="SimplePie Compatibility Test" /></h2>

			<h3>Minimum Requirements</h3>
			<table cellpadding="0" cellspacing="0" border="0" width="100%" id="chart">
				<thead>
					<tr>
						<th>Test</th>
						<th>Should Be</th>
						<th>What You Have</th>
					</tr>
				</thead>
				<tbody>
					<tr class="<?php echo ($php_ok) ? 'enabled' : 'disabled'; ?>">
						<td>PHP</td>
						<td>5.2 or newer</td>
						<td><?php echo phpversion(); ?></td>
					</tr>
					<tr class="<?php echo ($curl_ok) ? 'enabled' : 'disabled'; ?>">
						<td><a href="http://php.net/curl">cURL</a></td>
						<td>7.15.0 or newer, with SSL</td>
						<td><?php echo ($curl_ok) ? ($curl_version['version'] . ' (' . $curl_version['ssl_version'] . ')') : ($curl_version['version'] . (in_array('https', $curl_version['protocols'], true) ? ' (with ' . $curl_version['ssl_version'] . ')' : ' (without SSL)')); ?></td>
					</tr>
					<tr class="<?php echo ($simplexml_ok) ? 'enabled' : 'disabled'; ?>">
						<td><a href="http://php.net/simplexml">SimpleXML</a></td>
						<td>Enabled</td>
						<td><?php echo ($simplexml_ok) ? 'Enabled' : 'Disabled'; ?></td>
					</tr>
					<tr class="<?php echo ($spl_ok) ? 'enabled' : 'disabled'; ?>">
						<td><a href="http://php.net/spl">SPL</a></td>
						<td>Enabled</td>
						<td><?php echo ($spl_ok) ? 'Enabled' : 'Disabled'; ?></td>
					</tr>
					<tr class="<?php echo ($json_ok) ? 'enabled' : 'disabled'; ?>">
						<td><a href="http://php.net/json">JSON</a></td>
						<td>Enabled</td>
						<td><?php echo ($json_ok) ? 'Enabled' : 'Disabled'; ?></td>
					</tr>
					<tr class="<?php echo ($pcre_ok) ? 'enabled' : 'disabled'; ?>">
						<td><a href="http://php.net/pcre">PCRE</a></td>
						<td>Enabled</td>
						<td><?php echo ($pcre_ok) ? 'Enabled' : 'Disabled'; ?></td>
					</tr>
					<tr class="<?php echo ($file_ok) ? 'enabled' : 'disabled'; ?>">
						<td>File System <a href="http://php.net/file_get_contents">Read</a>/<a href="http://php.net/file_put_contents">Write</a></td>
						<td>Enabled</td>
						<td><?php echo ($file_ok) ? 'Enabled' : 'Disabled'; ?></td>
					</tr>
				</tbody>
			</table>

			<h3>Optional Extensions</h3>
			<table cellpadding="0" cellspacing="0" border="0" width="100%" id="chart">
				<thead>
					<tr>
						<th>Test</th>
						<th>Would Like To Be</th>
						<th>What You Have</th>
					</tr>
				</thead>
				<tbody>
					<tr class="<?php echo ($openssl_ok) ? 'enabled' : 'disabled'; ?>">
						<td><a href="http://php.net/openssl">OpenSSL</a></td>
						<td>Enabled</td>
						<td><?php echo ($openssl_ok) ? 'Enabled' : 'Disabled'; ?></td>
					</tr>
					<tr class="<?php echo ($zlib_ok) ? 'enabled' : 'disabled'; ?>">
						<td><a href="http://php.net/zlib">Zlib</a></td>
						<td>Enabled</td>
						<td><?php echo ($zlib_ok) ? 'Enabled' : 'Disabled'; ?></td>
					</tr>
					<tr class="<?php echo ($apc_ok) ? 'enabled' : 'disabled'; ?>">
						<td><a href="http://php.net/apc">APC</a></td>
						<td>Enabled</td>
						<td><?php echo ($apc_ok) ? 'Enabled' : 'Disabled'; ?></td>
					</tr>
					<tr class="<?php echo ($xcache_ok) ? 'enabled' : 'disabled'; ?>">
						<td><a href="http://xcache.lighttpd.net">XCache</a></td>
						<td>Enabled</td>
						<td><?php echo ($xcache_ok) ? 'Enabled' : 'Disabled'; ?></td>
					</tr>
					<tr class="<?php echo ($memcache_ok) ? 'enabled' : 'disabled'; ?>">
						<td><a href="http://php.net/memcache">Memcache</a></td>
						<td>Enabled</td>
						<td><?php echo ($memcache_ok) ? 'Enabled' : 'Disabled'; ?></td>
					</tr>
					<tr class="<?php echo ($memcached_ok) ? 'enabled' : 'disabled'; ?>">
						<td><a href="http://php.net/memcached">Memcached</a></td>
						<td>Enabled</td>
						<td><?php echo ($memcached_ok) ? 'Enabled' : 'Disabled'; ?></td>
					</tr>
					<tr class="<?php echo ($pdo_ok) ? 'enabled' : 'disabled'; ?>">
						<td><a href="http://php.net/pdo">PDO</a></td>
						<td>Enabled</td>
						<td><?php echo ($pdo_ok) ? 'Enabled' : 'Disabled'; ?></td>
					</tr>
					<tr class="<?php echo ($pdo_sqlite_ok) ? 'enabled' : 'disabled'; ?>">
						<td><a href="http://php.net/pdo-sqlite">PDO-SQLite</a></td>
						<td>Enabled</td>
						<td><?php echo ($pdo_sqlite_ok) ? 'Enabled' : 'Disabled'; ?></td>
					</tr>
					<tr class="<?php echo ($sqlite2_ok) ? 'enabled' : 'disabled'; ?>">
						<td><a href="http://php.net/sqlite">SQLite 2</a></td>
						<td>Enabled</td>
						<td><?php echo ($sqlite2_ok) ? 'Enabled' : 'Disabled'; ?></td>
					</tr>
					<tr class="<?php echo ($sqlite3_ok) ? 'enabled' : 'disabled'; ?>">
						<td><a href="http://php.net/sqlite3">SQLite 3</a></td>
						<td>Enabled</td>
						<td><?php echo ($sqlite3_ok) ? 'Enabled' : 'Disabled'; ?></td>
					</tr>
				</tbody>
			</table>

			<br>
		</div>

		<?php if ($php_ok && $curl_ok && $simplexml_ok && $spl_ok && $json_ok && $pcre_ok && $file_ok && $openssl_ok && $zlib_ok && ($apc_ok || $xcache_ok || $mc_ok || $sqlite_ok)): ?>
		<div class="chunk important ok">
			<h3>Bottom Line: Yes, you can!</h3>
			<p>Your PHP environment is ready to go, and can take advantage of all possible features!</p>
		</div>
		<div class="chunk">
			<h3>What's Next?</h3>
			<p>You can download the latest version of the <a href="http://aws.amazon.com/sdkforphp"><strong>AWS SDK for PHP</strong></a> and install it by <a href="http://aws.amazon.com/sdkforphp/getting-started">following the instructions</a>. Also, check out our library of <a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=4262">screencasts and tutorials</a>.</p>
			<p>Take the time to read <a href="http://aws.amazon.com/sdkforphp/getting-started">"Getting Started"</a> to make sure you're prepared to use the AWS SDK for PHP. No seriously, read it.</p>
		</div>
		<?php elseif ($php_ok && $curl_ok && $simplexml_ok && $spl_ok && $json_ok && $pcre_ok && $file_ok): ?>
		<div class="chunk important ok">
			<h3>Bottom Line: Yes, you can!</h3>
			<p>Your PHP environment is ready to go! <i>There are a couple of minor features that you won't be able to take advantage of, but nothing that's a show-stopper.</i></p>
		</div>
		<div class="chunk">
			<h3>What's Next?</h3>
			<p>You can download the latest version of the <a href="http://aws.amazon.com/sdkforphp"><strong>AWS SDK for PHP</strong></a> and install it by <a href="http://aws.amazon.com/sdkforphp/getting-started">following the instructions</a>. Also, check out our library of <a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=4262">screencasts and tutorials</a>.</p>
			<p>Take the time to read <a href="http://aws.amazon.com/sdkforphp/getting-started">"Getting Started"</a> to make sure you're prepared to use the AWS SDK for PHP. No seriously, read it.</p>
		</div>
		<?php else: ?>
		<div class="chunk important error">
			<h3>Bottom Line: We're sorry&hellip;</h3>
			<p>Your PHP environment does not support the minimum requirements for the <strong>AWS SDK for PHP</strong>.</p>
		</div>
		<div class="chunk">
			<h3>What's Next?</h3>
			<p>If you're using a shared hosting plan, it may be a good idea to contact your web host and ask them to install a more recent version of PHP and relevant extensions.</p>
			<p>If you have control over your PHP environment, we recommended that you upgrade your PHP environment. Check out the "Set Up Your Environment" section of the <a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=4261&categoryID=329">Getting Started Guide</a> for more information.</p>
		</div>
		<?php endif; ?>

		<div class="chunk">
			<h3>Give me the details!</h3>
			<?php if ($php_ok && $curl_ok && $simplexml_ok && $spl_ok && $json_ok && $pcre_ok && $file_ok): ?>
			<ol>
				<li><em>Your environment meets the minimum requirements for using the <strong>AWS SDK for PHP</strong>!</em></li>

				<?php if ($openssl_ok): ?>
				<li>The <a href="http://php.net/openssl">OpenSSL</a> extension is installed. This will allow you to use <a href="http://docs.amazonwebservices.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html">CloudFront Private URLs</a> and decrypt Microsoft&reg; Windows&reg; instance passwords.</li>
				<?php endif; ?>

				<?php if ($zlib_ok): ?>
				<li>The <a href="http://php.net/zlib">Zlib</a> extension is installed. The SDK will automatically leverage the compression capabilities of Zlib.</li>
				<?php endif; ?>

				<?php
				$storage_types = array();
				if ($file_ok) { $storage_types[] = '<a href="http://php.net/file_put_contents">The file system</a>'; }
				if ($apc_ok) { $storage_types[] = '<a href="http://php.net/apc">APC</a>'; }
				if ($xcache_ok) { $storage_types[] = '<a href="http://xcache.lighttpd.net">XCache</a>'; }
				if ($sqlite_ok && $sqlite3_ok) { $storage_types[] = '<a href="http://php.net/sqlite3">SQLite 3</a>'; }
				elseif ($sqlite_ok && $sqlite2_ok) { $storage_types[] = '<a href="http://php.net/sqlite">SQLite 2</a>'; }
				if ($memcached_ok) { $storage_types[] = '<a href="http://php.net/memcached">Memcached</a>'; }
				elseif ($memcache_ok) { $storage_types[] = '<a href="http://php.net/memcache">Memcache</a>'; }
				?>
				<li>Storage types available for response caching: <?php echo implode(', ', $storage_types); ?></li>
			</ol>

				<?php if (!$openssl_ok && !$zlib_ok): ?>
				<p class="footnote"><strong>NOTE:</strong> You're missing the <a href="http://php.net/openssl">OpenSSL</a> extension, which means that you won't be able to take advantage of <a href="http://docs.amazonwebservices.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html">CloudFront Private URLs</a> or decrypt Microsoft&reg; Windows&reg; instance passwords. You're also missing the <a href="http://php.net/zlib">Zlib</a> extension, which means that responses from Amazon's services will take a little longer to download and you won't be able to take advantage of compression with the <i>response caching</i> feature.</p>
				<?php elseif (!$zlib_ok): ?>
				<p class="footnote"><strong>NOTE:</strong> You're missing the <a href="http://php.net/zlib">Zlib</a> extension, which means that responses from Amazon's services will take a little longer to download and you won't be able to take advantage of compression with the <i>response caching</i> feature.</p>
				<?php elseif (!$openssl_ok): ?>
				<p class="footnote"><strong>NOTE:</strong> You're missing the <a href="http://php.net/openssl">OpenSSL</a> extension, which means that you won't be able to take advantage of <a href="http://docs.amazonwebservices.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html">CloudFront Private URLs</a> or decrypt Microsoft&reg; Windows&reg; instance passwords.</p>
				<?php endif; ?>

			<?php else: ?>
			<ol>
				<?php if (!$php_ok): ?>
					<li><strong>PHP:</strong> You are running an unsupported version of PHP.</li>
				<?php endif; ?>

				<?php if (!$curl_ok): ?>
					<li><strong>cURL:</strong> The <a href="http://php.net/curl">cURL</a> extension is not available. Without cURL, the SDK cannot connect to &mdash; or authenticate with &mdash; Amazon's services.</li>
				<?php endif; ?>

				<?php if (!$simplexml_ok): ?>
					<li><strong>SimpleXML:</strong> The <a href="http://php.net/simplexml">SimpleXML</a> extension is not available. Without SimpleXML, the SDK cannot parse the XML responses from Amazon's services.</li>
				<?php endif; ?>

				<?php if (!$spl_ok): ?>
					<li><strong>SPL:</strong> <a href="http://php.net/spl">Standard PHP Library</a> support is not available. Without SPL support, the SDK cannot autoload the required PHP classes.</li>
				<?php endif; ?>

				<?php if (!$json_ok): ?>
					<li><strong>JSON:</strong> <a href="http://php.net/json">JSON</a> support is not available. AWS leverages JSON heavily in many of its services.</li>
				<?php endif; ?>

				<?php if (!$pcre_ok): ?>
					<li><strong>PCRE:</strong> Your PHP installation doesn't support Perl-Compatible Regular Expressions (PCRE). Without PCRE, the SDK cannot do any filtering via regular expressions.</li>
				<?php endif; ?>

				<?php if (!$file_ok): ?>
					<li><strong>File System Read/Write:</strong> The <a href="http://php.net/file_get_contents">file_get_contents()</a> and/or <a href="http://php.net/file_put_contents">file_put_contents()</a> functions have been disabled. Without them, the SDK cannot read from, or write to, the file system.</li>
				<?php endif; ?>
			</ol>
			<?php endif; ?>
		</div>

		<div class="chunk">
			<p class="footnote"><strong>NOTE</strong>: Passing this test does not guarantee that the AWS SDK for PHP will run on your web server &mdash; it only ensures that the requirements have been addressed.</p>
		</div>
	</div>

</div>

</body>
</html>