Just like with learning anything new, one of the hardest things to determine is where to start. In most endeavors, it is that initial fear of thinking you are in way over your head that will hold a person back. The platforms and/or products I list in the following summary, are programs I use personally. In no way am I advocating they are the best ones, they are just what I have found work the best for me and once I find a program that I like I tend to quit looking for better options, that being said, feel free to look around, and explore other possibilities.
To start we obviously need PHP itself to be downloaded onto your computer. Just go to download PHP and download it to your computer.
Now that you have PHP successfully installed, we need somewhere we can actually write the code. I use Visual Studio Code. Once it is downloaded and installed, it is as simple as saving a blank notepad document, but instead of saving it with a ‘.txt’ extension at the end of the file name, use a ‘.php’. Now when you right click on that file and go to ‘Open With’, select Visual Studio Code, and it will open up to you a blank template to use. In order to write PHP code, it needs to be within PHP tags. The starting tag looks like ‘’. Anything in between these tags will be read as PHP code.
Now that we have PHP installed, and a place to write our code, the next thing we will need is a software that will allow us to run the code so we can see our work come to life. I use Xampp. Once it is downloaded there are some slight modifications needed to make it run, but not that many. If you don’t alter any of the steps in the Xampp installation process, Xampp will be saved within your C:\ (Local Disk C:) file path on your computer. If we go there and click on Xampp, it will open into many different options. Now it is the ‘htdocs’ folder where you will want to save all your projects of work. For example, go inside the htdocs folder and save an empty document called ‘hello-world.php’. Now find where Xampp is on your computer and run it. You will get a pop-up that looks as follows except you won’t have any messages displayed yet I am sure.
When you click on run next to Apache, you should see two numbers under ports that appear. Usually, these numbers will be 443 plus a second one. It is this second one that we are interested in, as you can see in my image I am using 801(Yours most likely will vary). Now open up a web browser and type in localhost:801/hello-world.php (insert your number for 801). When you hit enter you should be brought to a blank white page since we have not yet placed any code yet into the file.
Our next step is just a test to confirm whether or not, your browser is currently programmed to read PHP tags or not. So let’s open the hello-world.php file and in between the PHP tags that you have there already let’s right – echo ‘Hello World’; -. Now to get the code to show up in the browser it is as simple as saving the file so do that. Then go back to the browser and reload the page…
Now that we got PHP installed and a way to write the code, the next step is to actually learn how to use PHP. A book I received in college I find extremely helpful is PHP and MySQL Web Development. Don’t get intimidated by its length as it is very useful in explaining step by step the processes they use, and it builds from start to finish on the same example so you will slowly see a full functioning site come to life in front of your eyes. If a text book isn’t for you, and you want a quicker more brief way to learn, I would suggest using the PHP learning section with Codecademy. I find this site to be the best teaching tool for covering a vastly wide array of languages and different aspects of programming. I recommend completing as many courses as possible to strengthen your grasp.
In conclusion, I will add to make sure you are constantly searching out how to fix problems you encounter along the way. It makes no sense to waste time and frustrating on a problem when the solution is usually a simple internet search away. And finally, I will add, to make sure you are actually obtaining and learning the material as you go. It is very easy to skim through courses and make things work as they should by following step by step processes, but if you don’t retain the reasons on why the code works, you aren’t learning anywhere near the valuable information that you could be.
More News to Read