This is an introductory tutorial where we setup our first PHP-MySQL project using XAMPP. Follow the following steps to get started with web application development without any hassel. I want to keep everything simple and step by step guide for beginners.
Step 1: Download XAMPP to your system:-
Pick up the latest XAMPP installation version and download it to your system. (In case of windows user,) make sure you download it in separate directory other than the one where you have your windows installed. So as to keep things organised and free from hassel.
Step 2: Intall XAMPP server:-
Click on the application you just downloaded and follow the installation procedure step by step. Check on the MySQL, Apache services and install them all (though not recommended as it may sometimes clash with other network services running on your system)
Install this application in a separate directory; the one you made during download.
Step 3: Test it:-
Run the XAMPP application by clicking the shortcut on your desktop. (In case of Mac, find it in your applications folder.)
You will see a control panel for the XAMPP server. Start MySQL as well Apache Services by clicking on the start/run button beside.
Once started successfully, it will show you the status (green means running). If you are not able to start it and the server shows “busy” status, it means that you are already using the port required by MySQL and Apache. Quit all the applications like Hamachi, Skype and any other network service. Start the service again. It must be running now.
Now open your browser (IExplorer/Chrome/Firefox… etc) and type in “http://localhost/xampp”. You will see XAMPP logo or home page. This means your services are running successfully and now you may start web application development in PHP – MySQL.
Step 4: Download an Editor/IDE to code your programs:-
Sublime has pretty nice interface and is quiet efficient. Notepad++ is the simplest (my first editor). Dreamweaver is a lot more than an editor and has some extra nice features but it’s not free.
Step 5: Create first project:-
Okay so here is the most interesting step. Locate the directory where you installed your XAMPP application. and then go to “…/XAMPP/htdocs/“. Create a new folder and call it “myFirstProject” (or whatever you like). Open an editor and write the following code
<html><head><title> Title of Page </title></head><body><p>Paragraph of the Page.</p><?php echo “My first PHP script.”;?></body></html>
Save this as “myPage.php” in “…/XAMPP/htdocs/myFirstProject/” folder.
Now type the following url in your browser “http://localhost/myFirstProject/myPage.php“.
You will be able to see something like:
Paragraph of the Page.
My first PHP script.
Viola! You just created your first php page! Remember the following things.
- myFirstProject = Your Project Directory.
- myPage.php = Your PHP script/Web page.
- htdocs = workspace; where you create your web projects (always make a new directory for each project with in this folder).
- http://localhost/myFirstProject = The local URL of your website.
Feel free to comment below if you have any suggestions or issue with getting started. I would love to help 🙂 Don’t forget me if you find any bug. (Exterminate them all!!) =D