You are not logged in.

#1 2012-09-20 11:55:23

DoYouSpeakWak
Member
From: Denmark
Registered: 2012-02-12
Posts: 30

Display kernel,php and mysql in html

Hey everybody.

These last few days i have been snooping around for a solution for this idea. we wanna be proud of arch and show it on out website that we are up to date. But the solution doesnt seem to come easy when you dont wanna show a full phpinfo page.

Any ideas if this is a lost battle or if its posible at at all ?

Wak

Offline

#2 2012-09-20 18:12:19

astiak
Member
From: London, UK
Registered: 2010-12-14
Posts: 16

Re: Display kernel,php and mysql in html

Hi. If you are requesting how to display kernel version, PHP version and MySQL version by use of PHP it can be done with the following code:

<?php 
// Operating system and release name
echo 'Operating System:' . php_uname(s) . ' ' . php_uname(r);
echo '<br />';
// Prints current PHP version
echo 'PHP Version:' .  phpversion();
echo '<br />';
// Prints current MySQL version
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
printf("MySQL server version: %s\n", mysql_get_server_info());
?>

All this information is available on the PHP manual, which is a great bit of documentation for learning PHP. Hoping this is what you were after!

I should however warn you that it is generally not advisable to display version information as you increase the chances of people taking advantage of exploitations available. In terms of server security it is actually a better idea to hide this information, but achieving this is a discussion for another topic.

Regards,
Astiak.

Offline

#3 2012-09-22 14:31:01

DoYouSpeakWak
Member
From: Denmark
Registered: 2012-02-12
Posts: 30

Re: Display kernel,php and mysql in html

Thx so much, now i just gotta figure out how to put that in my html files. And yes its not adviseable i know but we are not high risk and with the package in arch they are up to date 99% of the time. If a hacker wanna hack based on old versions he will find another place.

Offline

Board footer

Powered by FluxBB