Check Apache version by PHP

Beside use command to check the version, you can use the php script to check the php version. Why that so? So application do need to verify by php first before allow you to install the apps.


$ar = split("[/ ]",$_SERVER['SERVER_SOFTWARE']);
for ($i=0;$i<(count($ar));$i++)
case 'APACHE':
$Apache_Version = $ar[$i];
case 'PHP':
$PHP_Version = $ar[$i];
case 'MOD_SSL':
$MOD_SSL_Version = $ar[$i];
case 'OPENSSL':
$OPENSSL_Version = $ar[$i];

Echo "Apache Version: $Apache_Version<br>\n";
Echo "PHP Version: $PHP_Version<br>\n";
Echo "mod_ssl Version: $MOD_SSL_Version<br>\n";
Echo "OpenSSL Version: $OPENSSL_Version<br>\n";


How to set redirection by

IIS Redirect

(1) In internet services manager, right click on the file or folder you wish to redirect
(2) Select the radio titled “a redirection to a URL”.
(3) Enter the redirection page
(4) Check “The exact url entered above” and the “A permanent redirection for this resource”
(5) Click on ‘Apply’

ColdFusion Redirect

<.cfheader statuscode="301" statustext="Moved permanently">
<.cfheader name="Location" value="">

PHP Redirect

Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location:" );

ASP Redirect

<%@ Language=VBScript %>
Response.Status="301 Moved Permanently"
Response.AddHeader "Location",""

ASP .NET Redirect

<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
Response.Status = "301 Moved Permanently";

JSP (Java) Redirect

response.setHeader( "Location", "" );
response.setHeader( "Connection", "close" );

CGI PERL Redirect

$q = new CGI;
print $q->redirect("");

Ruby on Rails Redirect

def old_action
headers["Status"] = "301 Moved Permanently"
redirect_to ""

.htaccess redirect

RewriteEngine on
rewritecond %{http_host} ^ [nc]
rewriterule ^(.*)$$1 [r=301,nc]

Change the collation for all tables in a MySQL database

How to change the database collation is easy, but how to change all the table collation? You can use script as below

This example is change all table collation to utf8_general_ci

$db = mysql_connect('localhost','dbuser','password');
if(!$db) echo "Cannot connect to the database - incorrect details";
mysql_select_db('dbname'); $result=mysql_query('show tables');
while($tables = mysql_fetch_array($result)) {
foreach ($tables as $key => $value) {
mysql_query("ALTER TABLE $value COLLATE utf8_general_ci");
echo "The collation of your database has been successfully changed!";

dbuser= database user
password= database user password
dbname= database name

php_mssql.dll enabled?

How to check if the php_mssql.dll is enabled and it working? Create the php file with the script as below will do.


if (function_exists('mssql_connect'))
echo "Okay, fn is there";
echo "Hmmm .. fn is not even there";