Skip to content

Instantly share code, notes, and snippets.

@tuxmartin
Created October 24, 2018 21:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tuxmartin/254323e9dd66c1ec5e79e7061d4b679b to your computer and use it in GitHub Desktop.
Save tuxmartin/254323e9dd66c1ec5e79e7061d4b679b to your computer and use it in GitHub Desktop.
root@testphp:/# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 9.5 (stretch)
Release: 9.5
Codename: stretch
root@testphp:/# mysql -u test -ptest -e "SHOW DATABASES;"
+--------------------+
| Database |
+--------------------+
| information_schema |
| test |
+--------------------+
root@testphp:/# cat /var/www/html/mysql.php
<?php
echo 'Current PHP version: ' . phpversion();
$link = mysql_connect("localhost", "test", "test")
or die("Could not connect: " . mysql_error());
echo ("Connected successfully\n");
$db_list = mysql_list_dbs($link);
while ($db = mysql_fetch_object($db_list))
{
echo $db->Database . "<br />\n";
}
mysql_close($link);
?>
root@testphp:/# curl http://localhost/mysql.php
Current PHP version: 5.6.38-2+0~20181015120829.6+stretch~1.gbp567807Connected successfully
information_schema<br />
test<br />
root@testphp:/#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment