[EXTENSION] Version-checker for Apache, PHP, and so on
Posted by: spreed (---.netcologne.de)
Date: August 02, 2014 05:00PM

Hi@ll,

I wonder why there's no actual version checker, however, I've made one simple version.php, which works with WAMP 2.5 (should also work with all other versions of WAMP).

How to use:
» Create a 'version.php' in your root www folder (C:\wamp\www\version.php) and copy all the code into it.
» Goto 'http://localhost/version.php'
» Have fun

Maybe this could be integrated in like WAMP 2.6

For bugs etc. feel free to contact me

EDIT: version0.2 - Fixed the bugs described in the 2nd post

<?PHP
// Set your defualt account
$mysqluser = 'root';
$mysqlpass = '';
// ################################
// ## DONT EDIT BEYOND THIS LINE ##
// ################################
echo '<div id=\'load\' style="display:block;">Query websites.... Please stay patient</div>';
ob_flush();
flush();
if(!isset($_GET['user'])) {
@$link = mysqli_connect('localhost',$mysqluser,$mysqlpass);}else{@$link = mysqli_connect('localhost',strval($_GET['user']),strval($_GET['pass']));}
$phpvers = phpversion();
$apachevers = substr(apache_get_version(),7);
$apachevers = substr($apachevers,0,stripos( $apachevers,'(') - 1);
@$mysqlvers = mysqli_get_server_info($link);
// GET latest Apache
$apachelatest = NULL;
$apachetick = NULL;
$tmp = file_get_contents('https://httpd.apache.org/download.cgi');
$tmp = substr_replace(strval($tmp),'',0,stripos($tmp,'<p>Stable Release - Latest Version:</p>'));
$tmp = substr($tmp,stripos($tmp,'">') +2);
$apachelatest = substr($tmp,0,stripos($tmp,'</a>'));
if($apachelatest == $apachevers) { $apachetick = '&#10004;'; } else { $apachetick = '&#10008;';}
echo '<div id=\'load0\' style="display:block;">Proceeding Apache version...</div>';
ob_flush();
flush();
// GET latest PHP
$phplatest = NULL;
$phptick = NULL;
$tmp = file_get_contents('http://de2.php.net/downloads.php');
$tmp = substr_replace(strval($tmp),'',0,stripos($tmp,'Current Stable</span>') + 22);
$tmp = substr($tmp,0,stripos($tmp,'<a href=') - 1);
$tmp = str_replace(' ','',$tmp);
$phplatest = str_replace('PHP','',$tmp);
if($phplatest == $phpvers) { $phptick = '&#10004;'; } else { $phptick = '&#10008;';}
echo '<div id=\'load1\' style="display:block;">Proceeding PHP version...</div>';
ob_flush();
flush();
// GET latest MySQL
$mysqllatest = NULL;
$mysqltick = NULL;
$tmp = file_get_contents('http://dev.mysql.com/downloads/');
$tmp = substr_replace(strval($tmp),'',0,stripos($tmp,'Available Release:') + 18);
$tmp = substr($tmp,0,stripos($tmp,')</span>'));
$mysqllatest = str_replace(' ','',$tmp);
if($mysqllatest == $mysqlvers) { $mysqltick = '&#10004;'; } else { $mysqltick = '&#10008;';}
echo '<div id=\'load2\' style="display:block;">Proceeding MySQL version...</div>';
$showmysqllog = 'none';
if($mysqlvers == NULL) {
	$mysqlvers = '---';
	$mysqltick = '';
	$showmysqllog = 'block';
}
ob_flush();
flush();
// GETTING INFO about phpMyAdmin
$phpmyadmincurrent = NULL;
$tmp = file_get_contents('http://localhost/phpmyadmin/version_check.php');
$tmp = json_decode($tmp);
$phpmyadmincurrent = $tmp->version;
echo '<div id=\'load3\' style="display:block;">Proceeding phpMyAdmin installation...</div>';
ob_flush();
flush();
// GET latest phpMyAdmin
$phpmyadminlatest = NULL;
$phpmyadmintick = NULL;
$tmp = file_get_contents('http://www.phpmyadmin.net/home_page/downloads.php');
$tmp = substr_replace(strval($tmp),'',0,stripos($tmp,'<h2>phpMyAdmin') + 14);
$tmp = substr($tmp,0,stripos($tmp,'</h2>'));
$phpmyadminlatest = str_replace(' ','',$tmp);

if($phpmyadminlatest == $phpmyadmincurrent) { $phpmyadmintick = ' &#10004;'; } else { $phpmyadmintick = '&#10008;';}
echo '<div id=\'load4\' style="display:block;">Proceeding phpMyAdmin version...</div>';
ob_flush();
flush();
// 
sleep(2);
echo '<script type="text/javascript">document.getElementById(\'load\').style.display = \'none\';</script>';
echo '<script type="text/javascript">document.getElementById(\'load0\').style.display = \'none\';</script>';
echo '<script type="text/javascript">document.getElementById(\'load1\').style.display = \'none\';</script>';
echo '<script type="text/javascript">document.getElementById(\'load2\').style.display = \'none\';</script>';
echo '<script type="text/javascript">document.getElementById(\'load3\').style.display = \'none\';</script>';
echo '<script type="text/javascript">document.getElementById(\'load4\').style.display = \'none\';</script>';
ob_end_flush();
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>WAMP - Version checker by Markus Wackermann</title>
</head>
<body>
<table width="630" border="0" cellspacing="0" cellpadding="5">
  <tbody>
    <tr>
      <td width="93">&nbsp;</td>
      <td width="134">My version</td>
      <td width="189">Current Stable</td>
      <td width="174">&nbsp;</td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>PHP:</td>
      <td><?PHP echo $phpvers; ?></td>
      <td><?PHP echo $phplatest; ?></td>
      <td><?PHP echo $phptick; ?></td>
    </tr>
    <tr>
      <td>Apache:</td>
      <td><?PHP echo $apachevers; ?></td>
      <td><?PHP echo $apachelatest; ?></td>
      <td><?PHP echo $apachetick; ?></td>
    </tr>
    <tr>
      <td>MySQL:</td>
      <td><?PHP echo $mysqlvers; ?></td>
      <td><?PHP echo $mysqllatest; ?></td>
      <td><?PHP echo $mysqltick; ?></td>
    </tr>
    <tr>
      <td>phpMyAdmin:</td>
      <td><?PHP echo $phpmyadmincurrent; ?></td>
      <td><?PHP echo $phpmyadminlatest; ?></td>
      <td><?PHP echo $phpmyadmintick; ?></td>
    </tr>
  </tbody>
</table><br /><br />
<div id="credits" style="font-size:9px;">2014 &copy; Markus Wackermann // version.php v0.2</div>
<br />
<div id="nologin" style="display:<?PHP echo $showmysqllog ?>; font-size:12px;">
<form>
<table width="400" border="1" cellspacing="0" cellpadding="5" style="background-color:#B3B2B2">
  <tbody>
    <tr>
      <td colspan="2" style="background-color:#727171">MySQL Query failed, please log in</td>
      </tr>
    <tr>
      <td width="87">User:</td>
      <td width="287"><input type="text" name="user" id="user" style="font-size:12px;"></td>
    </tr>
    <tr>
      <td>Password:</td>
      <td><input type="text" name="pass" id="pass" style="font-size:12px;"></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><input type="submit" value="Enter"></td>
    </tr>
  </tbody>
</table>
</form>
</div>
</body>
</html>



Edited 2 time(s). Last edit at 08/03/2014 03:08PM by spreed.

Options: ReplyQuote
Re: [EXTENSION] Version-checker for Apache, PHP, and so on
Posted by: RiggsFolly (---.dynamic.dsl.as9105.com)
Date: August 02, 2014 06:30PM

Hi Marcus,

Not sure how useful this would actually be.

If people are actually interested the current release information it is easy enough to find out from a google query.

Also AlterWay do not supply every release of everything, so its only function would be to increase the number of help requests on this forum asking for versions that were not readily available.

Also the MYSQL and phpMyAmin code to get the currently installed versions did not work on my system.

Reason:

MySQL: The root user account does not exists on my system, and if it did it would have a password attached to it.


phpMyAdmin: I guess my version of this does not have the same page layout as yours.

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: [EXTENSION] Version-checker for Apache, PHP, and so on
Posted by: spreed (---.netcologne.de)
Date: August 02, 2014 06:57PM

Hi,

thanks for the fast reply. The actual idea behind it is to compare the existing versions with the latest available.
There are more effecient ways to do this job, for example with files comparison via the wampserver.exe(.NET code). However, this is a simple and very basic idea realized in php. Sure, and thats what i forgot to mention, to query the MySQL database you need to edit the mysqli_connect() line with your current account and to check the phpMyAdmin installation you gotta be already logged in, but I could make a workaournd for this, by query the existing version_check.php from phpMyAdmin, for example.

However, I think a version comparison/check would be ok for WAMP, though It does only support several builds, people could quickly check their versions, maybe with the warning that not everything is entirely supported.

I've seen so many threads on this forum about "how to update the apache/php/etc. server", so a quick guide posted on something like this(my version.php) could also throw down the number of questions on this and other forums.

Options: ReplyQuote
Re: [EXTENSION] Version-checker for Apache, PHP, and so on
Posted by: spreed (---.netcologne.de)
Date: August 03, 2014 03:30PM

UPDATE: you can now set your default account settings for the MySQL query, if it fails you'll be asked for them and the script retries it.
Also fixed the phpMyAdmin query, should work fine now.

Options: ReplyQuote
Re: [EXTENSION] Version-checker for Apache, PHP, and so on
Posted by: spreed (---.cgn.dg-w.de)
Date: October 16, 2018 10:24PM

It's been a while...

this script is now available at github under

[github.com]

Options: ReplyQuote


Sorry, only registered users may post in this forum.