I spent 12 hours on the day of my presentation trying to figure this out so if you ask me what was the inspiration behind writing this post, it's to save someone from this plight.
Go to https://www.php.net/downloads.php
I downloaded 7.2, on clicking on the link a zip folder gets downloaded, extract the files inside a folder PHP7 in the C drive.
If you use VSCode, change php.validate.executablePath = "C://PHP7//php.exe" in settings.json
Install the Code Runner Extension and run the file from terminal itself.
Go to https://www.apachefriends.org/download.html
and download the latest version of XAMPP, installation process begins, press Finish when it is done.
Go to C Drive -> xampp -> htdocs -> create a folder and store your php files there.
Inside your browser go to localhost/your folder name/path to your php file and you will be able to see your output on the webpage.
$host = "127.0.0.1";
$username = "root";
$pass = "foobar";
$conn = mysqli_connect($host, $username, $pass, "speed_age");
echo 'could not connect'.mysqli_error();
The next error I encountered was root@localhost not connected using password if you do too go to XAMPP Control Panel -> Config button for Apache Module -> phpMyAdmin -> Section under Authentication type and info
Change this line as $cfg['Servers'][$i]['password'] = 'your password';
I have used foobar so I changed it to $cfg['Servers'][$i]['password'] = 'foobar';
If you get the no database detected error go to Admin in MySQL Module -> Databases -> Create Database -> Give the name as you used in your code , I used speed_age in mine.
For creating tables and manipulate data in rows use GUI or go to SQL tab right to Databases and run query.
Thank you for reading , this is my first post let me know what you think :)