Introduction to PHP

In this guide, we will try to understand together the basics of one of the most used server-side scripting languages ​​on the Web. PHP or more precisely PHP Hypertext Preprocessor. It is good to point out right away that the purpose of this manual is to be a basic guide to PHP and therefore to provide basic knowledge to those who, for the first time, approach the topic.

What is PHP?

PHP is a very powerful scripting language that allows you to create complex server-side applications (ie running within a web server) such as forums, guestbooks, statistics systems, e-commerce, etc.

From a technical point of view we can say that a web server is able to “run” applications in PHP only when the real interpreter has been installed which has the task of reading the PHP syntax and transforming it into machine language.

Before proceeding, it is good to underline that PHP is a cross-platform language, this means that it works correctly on web servers equipped with different operating systems as there are different versions of the PHP interpreter capable of operating in both UNIX and Win environments. In principle we can say that it is recommended to use it on a Linux server (which is the native environment of this language) however, as mentioned, it is also possible to use it in a Windows environment (if properly equipped).

Create The Working Environment

If you have Windows and want to test locally the practical exercises that I will propose in this course I recommend you download WAMP, XAMPP or EasyPHP: these are two packages thanks to which you can automatically install the Apache WebServer, PHP and MySQL on your Windows PC.

If you use MAC OS X you can do the same by downloading MAMP, while if you use a Linux platform it is likely that everything you need is already installed on the system. Alternatively, I suggest you visit the following sites where you can download everything you need:

  • Apache: The official website of the most popular WebServer in the world. Freeware;
  • PHP: The official Php site where you can download the latest PHP release for free. Freeware;
  • MySQL: The official database site preferred by PHP developers. Powerful and Free.

The procedure for installing these software varies depending on the version of Linux you are using. I advise you to carefully follow the information contained in the manuals of the respective software.

Once the installation procedure is finished we can test its success with a few lines of PHP. Open a common text editor (Windows NotePad is fine!) And write:

<?php
phpinfo()
?>

Save as “info.php” in the webserver root. Now type:

http: //localhost/info.php

if everything went smoothly you should see a screen all information on the PHP version like this:

Now your PC is ready for PHP!

Leave a Comment