This is because PHP is a “serverside” programming language, which means that it is executed on a web server, and then it generates html code that will later be downloaded into the user’s webbrowser. This is usefull for websites and allows the development of web applications, content management systems, and more, software like wordpress, joomla, or drupal, are developed in PHP.
Next I’l leave you this video as an introduction to the PHP programming language, and a basic setup.
Introduction to PHP video tutorial
Requirements to do some programming in PHP
As a start, to develop using PHP we require the installation of a web server including the PHP interpreter so our code may be executed, for this I would recommend using a program called XAMPP, which you can find at http://www.apachefriends.org/en/xampp.html and that will properly install apache, PHP and MySQL(for using databases with php) in windows, mac or linux. To set it up you may find all the documentation at the xampp’s site, or you can watch the video above to get an idea.The next thing that you will need is any text editor you like, and a web browser, I would recommend using sublimeText (available for windows, mac) bluefish for linux, and google Chrome as a web browser.
First program in PHP, a simple “Hello World”
Now that we are ready, we can type in this code into a .php file, and see what happens, this is the hello world program that prints a simple message using php.1 | <?php |
2 |
3 | echo "Hello World!!" ; |
4 |
5 | ?> |
Access it by typing “http://localhost/yourphpfile.php” on your webbrowser and it’s don!!
Congrats on making your very first php application!