Intro to PHP

JoAnna Park
4 min readFeb 8, 2021

Part 1 — Installing PHP and a MySQL database

After graduating from my coding boot camp, I told myself that I would not dive into learning a new programming language until I felt really comfortable with the ones I learned within the boot camp. I practiced a lot of React by continuing to build applications with it.

What is a LAMP stack?

However, I recently made an exception to this decision when I got an opportunity to have a final interview for a company that used the LAMP stack. Although they already knew that I didn’t have any experience with the LAMP stack, I didn’t want to look like I had no idea on what it even was. I first started out with doing a basic google search, and here are my findings from stackoverflow :

LAMP diagram

LAMP stands for Linux OS, Apache, MySQL database and PHP.

  • Linux is an operating system, basically like Windows and Mac OS.
  • Apache is the web server software that allows for the web page to get to the user.
  • MySQL is where the databases live.
  • PHP is the programming language that glues all the other parts of the LAMP stack.

Also, the term “stack” is referring to a “solution stack” which is a complete set of software to address a given problem, usually by combining to provide the platform or infrastructure necessary. So a LAMP stack is a set of software that specifically aims to serve dynamic content over the web. Another example of a stack would be the MEAN stack, MongoDB-ExpressJS-Angular-JS-NodeJS.

My next step in beginning to learn PHP was to find a good tutorial that would help me setup PHP and other technologies I need into my system. I found The Net Ninja to have really good instructional videos on Javascript, so I checked if he had anything on PHP. Luckily, he had a full playlist of PHP tutorial videos!

The Net Ninja recommended that I download XAMPP which is a PHP development environment that you can easily download and install. XAMPP is an abbreviation for cross-platform, Apache, MariaDB(MySQL), PHP and PERL.

  • Side note for Mac users: One trouble I had while downloading this software was that for some reason, the downloaded file which was a zip file wouldn’t unzip. I had to re-download using Safari, and then it worked.

I don’t know if XAMPP made an update since this tutorial video or if it’s a difference between the Windows version and Mac version, but the XAMPP control panel looks a little bit different from the tutorial. Here are some screen shots of the differences:

XAMPP control panel General tab

This is where you can start the server up and see the status.

XAMPP Services tab

This is where you can start or stop the Apache and MySQL. I think all of this looks different on the Windows version.

XAMPP Network tab

This was the part I had to really figure out on my own. In the tutorial, the guy is able to start up the website without using a specific localhost number. If you are using a Mac like me, I would recommend enabling the 8080 and using that to view your project locally. After you enable this, you can go to localhost:8080 or localhost:8080/dashboard/ to check if XAMPP is working.

XAMPP Volumes tab

Now this was the really confusing part for me and is still confusing. I didn’t understand where the files for the dashboard page were located and couldn’t find them anywhere in my computer. Based on the tutorial, it looked like the Windows version has a folder called “xampp” created already, but I couldn’t find this in my Mac.

After trying different things, I realized that I had to mount the /opt/lampp in the Volumes tab of XAMPP and clicked on “Explore” to view the files. I still don’t fully understand how this works or what exactly is going on, but hopefully after building a few PHP projects, I’ll have a better understanding. Once in the lampp folder, you want to access a folder called ‘htdocs’, and you can see that the dashboard files are inside.

The last step I’m going to leave you with is just creating a new folder within the ‘htdocs’ folder so that we can start a new PHP project. We called this folder ‘tuts’, short for tutorial. I’ve been learning some cool things about PHP itself and getting some familiarity with the syntax, so I’m super excited to share them in my next blog post!!

Thanks for reading!

--

--