Location: PHPKode > scripts > POBusinessDir Pro Business Directory > pobusinessdir-pro-business-directory/prereq_test.php
<?php

$php_version_met_text = <<<TEXT
<b><u>PASS</u></b>
TEXT;

$php_version_not_met_text = <<<TEXT
The business directory script requires a PHP version 5.0.0 or higher. Please contact your customer support.
TEXT;

$php_version_check_result = version_compare(phpversion(), "5.0.0", ">=") ? $php_version_met_text : $php_version_not_met_text;

$mod_rewrite_enabled_text = <<<TEXT
<b><u>PASS</u></b>
TEXT;

$mod_rewrite_not_enabled_text = <<<TEXT
mod_rewrite is not enabled. To enable this do the following<br>
<b><u>If your server is shared hosting</u></b> - Please contact your customer support and tell them that mod_rewrite has to be enabled in Apache.<br>
<b><u>If your server is dedicated hosting</u></b> i.e. you'll have access to your apache config file httpd.conf. Open the httpd.conf look for a line <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i>#LoadModule rewrite_module modules/mod_rewrite.so</i><br>
Remove the <b>#</b> in the beginning and make it look like<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i>LoadModule rewrite_module modules/mod_rewrite.so</i><br>
Save the httpd.conf and restart your Apache server. You should have the restart option from your administrative panel. <br>
If you're not sure of any of these steps, please contact your customer support and tell them that mod_rewrite has to be enabled in Apache.<br>
TEXT;

$mod_rewrite_check_disabled = <<<TEXT
The function apache_get_modules might be blocked which is required to check mod_rewrite. <br>
If the <b>.htaccess</b> check below succeeds, then mod_rewrite is enabled.<br>
If not, to enable mod_rewrite do the following<br>
<b><u>If your server is shared hosting</u></b> - Please contact your customer support and tell them that mod_rewrite has to be enabled in Apache.<br>
<b><u>If your server is dedicated hosting</u></b> i.e. you'll have access to your apache config file httpd.conf. Open the httpd.conf look for a line <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i>#LoadModule rewrite_module modules/mod_rewrite.so</i><br>
Remove the <b>#</b> in the beginning and make it look like<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i>LoadModule rewrite_module modules/mod_rewrite.so</i><br>
Save the httpd.conf and restart your Apache server. You should have the restart option from your administrative panel. <br>
If you're not sure of any of these steps, please contact your customer support and tell them that mod_rewrite has to be enabled in Apache.<br>
TEXT;

$mod_rewrite_check_result = function_exists('apache_get_modules') ? (in_array("mod_rewrite", apache_get_modules()) ? $mod_rewrite_enabled_text : $mod_rewrite_not_enabled_text) : $mod_rewrite_check_disabled;

$htaccess_start_test = <<<TEXT
<a href="prereq_test.php?directVar=Y">Click on the this link to start the test.</a>
TEXT;

$htaccess_enabled = <<<TEXT
<b><u>PASS</u></b>
TEXT;

$htaccess_not_enabled = <<<TEXT
.htaccess is not enabled. To enable this do the following<br>
<b><u>If your server is shared hosting</u></b> - Please contact your customer support and tell them that .htaccess has to be allowed in Apache for your website.<br>
<b><u>If your server is dedicated hosting</u></b> i.e. you'll have access to your apache config file httpd.conf. Open the httpd.conf look for the text like <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i>AllowOverride</i><br>
This can be in multiple places. Look for the one under the tag <i>&lt;Directory <u>/public_html/somepath </u></i>> (Note: look for the path where the script is hosted instead of the example /pulic_html/somepath.) <br> 
After locating it, please ensure that the AllowOveride is set as follows <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<i>AllowOverride All</i><br>
Save the httpd.conf and restart your Apache server. You should have the restart option from your administrative panel. <br>
If you're not sure of any of these steps, please contact your customer support and tell them that .htaccess should be allowed in Apache for your website.<br>
TEXT;

$isFirstPage = !isset($_GET['directVar']);
$doesHtaccessWork = FALSE;
if (!$isFirstPage)
{
	$doesHtaccessWork = isset($_GET['htaccessWorks']);
}

$htaccess_check_result = $isFirstPage ? $htaccess_start_test : ($doesHtaccessWork ? $htaccess_enabled : $htaccess_not_enabled);

$curl_installed = <<<TEXT
<b><u>PASS</u></b>
TEXT;

$curl_not_installed = <<<TEXT
CURL is not installed. Installation steps for CURL will vary based on hosting software and/or provider. Please contact your customer support.
TEXT;

$curl_check_result = function_exists('curl_init') ? $curl_installed : $curl_not_installed;

?>

<HTML>
	<HEAD>
		<TITLE>business.phponly.com pre-requisites testing page</TITLE>
	</HEAD>
	<BODY>
		<TABLE border="1" cellpadding="1" cellspacing="1">
			<TR>
				<TH colspan="2" align="center">Pre-requisites tests</TH>
			</TR>
			<TR>
				<TD>PHP minimum version check:</TD>
				<TD><?php echo $php_version_check_result?></TD>
			</TR>
			<TR>
				<TD>Check if mod_rewrite is enabled:</TD>
				<TD><?php echo $mod_rewrite_check_result?></TD>
			</TR>
			<TR>
				<TD>Check if .htaccess is enabled:</TD>
				<TD><?php echo $htaccess_check_result?></TD>
			</TR>
			<TR>
				<TD>Check if CURL is installed:<br>(This is required for Authorize.Net <br>and GoogleCheckout payment gateways)</TD>
				<TD><?php echo $curl_check_result?></TD>
			</TR>
			<TR>
				<TD>ionCube Installation & Verification</TD>
				<TD><a href="ioncube-loader-helper.php">Click here to check ionCube.</a></TD>
			</TR>
		</TABLE>
		<br><br><br>
		<TABLE border="0" cellpadding="1" cellspacing="1">
			<TR>
				<TD><b>Additional information: </b><br><br><?php echo function_exists('phpinfo') ? phpinfo() : "phpinfo disabled.";?></TD>
			</TR>
		</TABLE>
	</BODY>
</HTML>
Return current item: POBusinessDir Pro Business Directory