File tree Expand file tree Collapse file tree 1 file changed +2
-24
lines changed
Expand file tree Collapse file tree 1 file changed +2
-24
lines changed Original file line number Diff line number Diff line change 11<?php
22
3- // phpinfo();
3+ phpinfo ();
44
5- $ contents = file_get_contents ( "../.env " );
6- $ lines = explode ( "\n" , $ contents );
7- foreach ($ lines as $ line ){
8- $ vars = explode ( "= " , $ line );
9- if ( $ vars [0 ] == "DB_USER " ) $ db_username = $ vars [1 ];
10- if ( $ vars [0 ] == "DB_PASSWORD " ) $ db_password = $ vars [1 ];
11- if ( $ vars [0 ] == "DB_NAME " ) $ db_name = $ vars [1 ];
12- }
13-
14- $ link = mysqli_connect ( 'database:3306 ' , $ db_username , $ db_password , $ db_name );
15-
16- //if connection is not successful you will see text error
17- if ( !$ link ) {
18- die ( 'Could not connect: ' . mysql_error () );
19- }
20-
21- //if connection is successfully you will see message below
22- echo 'Connected successfully ' ;
23- echo "Host information: " . mysqli_get_host_info ( $ link ) . PHP_EOL ;
24-
25- mysqli_close ( $ link );
26-
27- ?>
5+ ?>
You can’t perform that action at this time.
0 commit comments