Introduction to PHP and how to build your first web application in less than 10 minutes
Last Updated on Mar 21, 2023
PHP is an open source scripting language that runs on the server, in other words it’s a language for backend development.
Here we are going to build our very first PHP application together.
PHP can run on Windows, Linux, Mac OS, Unix, etc.
As for databases, PHP can support MySQL, MongoDB, PostgreSQL, SQLite and many other databases.
It’s very easy to learn.
oh and more than 75 percents of all the websites on the internet have PHP as their core language.
Just to get an idea of how powerful PHP is, Websites like Facebook, Wikipedia, Slack, MailChimp, Flickr, SourceForge, Tumblr, Etsy and Yahoo have PHP as their core.
If you go to w3schools’ PHP intro you’ll see this:
PHP is an amazing and popular language!
It is powerful enough to be at the core of the biggest blogging system on the web (WordPress)!
It is deep enough to run large social networks!
It is also easy enough to be a beginner’s first server side language!
enough teasing let’s get started with PHP.
How to Start (Step by Step)
Step 1: Install a web server
first you need to install a local web server on your computer. don’t worry. it’s easy.
There are many options but I personally prefer XAMPP. download it and install it on your computer.
if you open it you’ll see this window:
click on the start button in front of Apache and your window will change to this:
great. now you have a local web server running on your computer.
Step 2: Create a PHP file
first click on the explorer to go to the path that XAMPP was installed.
here you can see a folder called “htdocs”.
all your projects and PHP files should be inside this folder so XAMPP can run them.
so let’s create our first project.
create a new folder called “mysite”
inside this folder create a file called “index.php”
open the file
write this on your file
<?php echo "hello world!";
now save the file. perfect.
are you ready to see the results?
Step 3: Run
open your browser and go to the following address
you should see your “hello world” now.
You have started your journey to become a PHP developer.
Now you are able to work with PHP. You can add PHP to the unending list of your skills.
I recommend you to create a new file and echo something else. I’m sure you can learn a lot more by the end of today.
If you have any suggestions, questions, or opinion, please leave a comment below. I’m looking forward to hearing from you!
- What is PHP
- Why PHP is a good language to learn
- How to install a local web server
- Create your first PHP file
- Run your PHP application