Created
October 24, 2018 21:45
-
-
Save tuxmartin/254323e9dd66c1ec5e79e7061d4b679b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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