What is PHP? And why should I learn to use and where would I begin once I decide to use it? To start, PHP stands for ‘PHP: Hypertext Preprocessor’, and it is one of the most common server-side languages in programming today. The reason it is so popular is the fact that it is completely open sourced, which means anyone with access to the internet, is free to complete access to everything PHP has available to them. There are obvious reasons why a programmer should, and would, want to learn this language on that basis alone. Not only is it a programming skill you can use and implement free of cost, but there are a vast number of employers who incorporate this language on that basis alone. With the ease that it can be embedded into HTML, it won’t be long before you start seeing professional web development come to life in front of your very eyes.
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.
© FLIPBOARD - ORIGINAL AUTHORS