Jump to content

Get PHP, MySQL and misc. info


DeathStar

Recommended Posts

Hi

i'm making a scritp that will get the php version the mysql version the path the file is from.  but i need the text info not an if statement.

i also need a mysql install script(that writes something from the script into another php file.

 

here is my current script but i dont want it as an if statement.

 

if (version_compare(phpversion(), '4.2.0') < 0)
{
$phpver="<font color='red'>Not the Correct Version</font>";
$pvf=0;
}
else
{
$phpver="<font color='green'>4.2.0</font>";
$pvf=1;
}
if(is_writable('./'))
{
$write="<font color='green'>OK</font>";
$wvf=1;
}
else
{
$write="<font color='red'>Failed</font>";
$wvf=0;
}
if(function_exists('mysql_connect') || function_exists('mysqli_connect'))
{
$mysql"<font color='green'>Connected</font>";
$dvf=1;
}
else
{
$mysql="<font color='red'>Not Connected</font>";
$dvf=0;
}
if(str_replace('game_install.php','',$_SERVER['SCRIPT_NAME']) == "/")
{
$path="<font color='green'>Correct</font>";
$avf=1;
}
else
{
$path="<font color='red'>Not In root path</font>";
$avf=0;
}

Link to comment
https://forums.phpfreaks.com/topic/36702-get-php-mysql-and-misc-info/
Share on other sites

but also need an script that will write info to a php file.

 

$phpFile = "yourfile.php";
$run = fopen($phpFile, 'w') or die("Can't open the file");
$Data = "YOUR TEXT\n";
fwrite($run, $Data);
fclose($run);

 

This is only if I understood what you were trying to do correctly, I may have misinterpretted you.

 

Yes thats one part thanks  elis! ;)

 

what i want to make exactly is:

 

an install file.

Displays the php,mysql and apache version.

next i want it to goto a page that will ask for the mysqlhost, username, password and the database.

the. install the data if everything is right (php,mysql).

 

then write that info to an file. ex. config.php

 

now understand?

 

 

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.