Introduction
So, you have heard about all the wonderful things done in PHP. Owing to its extreme popularity, you would like to join the bandwagon. Wait!
- You do not know what I am talking about.
- What is PHP, you say?
Without further delay, let us speak about this.
What is PHP?
PHP is used to build web applications that run on servers. PHP Hypertext Preprocessor is its abbreviation. Its widespread use can be attributed, in part, to the fact that it was one of the first languages to permit the direct embedding of server-side code into HTML pages. Why would you want to learn PHP, though?
- It is easy to learn.
- It is easy to use.
- It is easy to get started with
How to get started
Nevertheless, you ponder the fundamental query: Where do you begin? Getting started is easy. Downloading a web server is all that is required. Afterwards , we would write the first line everyone does when they begin learning about code. That is the “Hello World” code.
Requirements
All that we will need is below.
- Internet connection
- Notepad
- Lots of enthusiasm!
PHP code can run thanks to the web server. It creates ( or compiles ) HTML files from computer files with the .php extension. For a web server, I suggest that you utilize the XAMPP web server. Follow the steps below, to begin with the XAMPP web server.
- Visit the link found here: https://www.apachefriends.org/download.html
- Click on the download link. Your file should start downloading afterward.
- This file should now reside in your Downloads folder.
- Click to install.
- Leave it as the default settings. Usually, these are the most recommended options.
- After you are done you will have the XAMPP control panel showing in your tray. You will have five services showing up. These are the Apache, MySQL, FileZilla, Mercury, and Tomcat services.
- For our purposes, we are interested in the MySQL and Apache services. Click on the start button for both services. Once it starts working then the backend of each Module name should be in green.
Creating our first PHP file
We are halfway done now. We just have to create the PHP file itself. This is even simpler than the first half.
- Navigate to the XAMPP subfolder. That should be.
C:\xampp\htdocs
This should have been created after our installation.
- Rename index.php: A default index.php file should be at this location. Every folder or subfolder (by default) always shows the index.php file. Let us rename the index.php file to index_old.php.
- Create index.php: Let us create our index.php file. Use Notepad to create this new file.
In the file, type ( or copy ) the text below
<?php
echo “Hello world”.
?>
Save the file as index.php; When saving the file, remember to leave the file type as *.*. By default, it would have been set to .txt
- Open file in a web browser: Navigate to 127.0.0.1 in your web browser.
You should see Hello World in plain white text. And it was all your effort. This is now your canvas to create more.
Conclusion
Is this not wonderful? You have come a long way in this single post, and you will soon dominate this new territory with this drive. Every expert once began as a beginner. So, let this enthusiasm persist and fuel your desire to learn more. It cannot pass away.
Until later, keep learning and soaring.