What is PHP

PHP is a server side scripting language. Originally PHP was an abbreviation of Personal Home Page, but now the meaning of this term has evolved to PHP Hypertext Preprocessor.

PHP is a web programming language and it is used for making dynamic Websites. Dynamic Websites usually interact with a database, e.g. a MySQL database.

If you have ever filled out a form on the web, the chances are it was processed by a server side programming language of some sort. PHP is currently the most popular server side language on the web (installed on over 1,000,000 web servers and 9,000,000 sites) but other popular languages include Perl, ColdFusion, Microsoft's ASP, Java Servlets and many more.

PHP's success can be accredited to a number of reasons:

  • It is free, Open Source software
  • It is Cross-Platform (it works in Windows, Mac, Linux)
  • It is extremely easy to learn
  • It is blazingly fast
  • It has excellent integration with Apache, the world's number one web server
  • It has excellent integration with mySQL, a popular open source relational database  

What do I require to run PHP?

 PHP is really easy to use. To start using PHP you will need following

  • An Operating System for example Window or Mac or Linux etc
  • Text Editor for example NotePage, Dreamweaver, Aptana studio, ZendIDE etc
  • Apache Web Server, that will run PHP Scripts
  • Optional: Database Server for example MySQL etc.

How Can I start Using PHP?

Once you have all these services installed and running on your computer, simply open you favourite text editor (for example notepad or dreamweaver) save your file with an extention of .php in your webserver.

To check your files start your browser for example internet explorer or firefox and type localhost or localhost:8888 if you are using a mac machine. This will bring your web server's default Home page.

Download and Install PHP

Apache, MySQL and most of the PHP editors are free and open source and you can download them for free. To download Apache web Server click here. MySQL can be found here.

Although it easy to download Apache and MySQL, configuring and installing these two can be a bit difficult for beginners.

A Simple and easy way to make PHP run on your computer is to use software that will install and configure every thing for you. If you are usign Windows you can download WAMP (Windows, Apache, MySql, PHP) here. If you use a  Mac machine, MAMP is the tool you need. Click here to download MAMP for Mac.

Once you have downloaded WAMP or MAMP, simply run it. This program will install and configure PHP, APACHE SERVER, MYSQL, PHP MYADMIN for you and you will be ready to start using PHP in 10 minutes. If you are facing any problem please do not hesitate to contact your trainer.

An easy way to start using PHP is to look for a MySQL + PHP Web hosting package. In this way you can concentrate more on learning PHP and MySQL than installation issue. Click here to Get your student Web hosting package

Set a new site in Dreamweaver

After you have successfully installed your WAMP / MAMP local server, you are ready to start. To work with php you can work on any web editor or IDE (Integrated Development Environment), but we will use Dreamweaver.

STEP 1. Create a folder in your local server (C:/wamp/www in WIN or Applications/MAMP/htdocs in MAC),let's call it MY_PHP (see pic below)

step one

 

STEP 2. To set a new site in DW,  click on Site > New Site

step2

 

STEP 3. Insert Site Name and select Local Site Folder (remember: wamp/www for WIN, MAMP/htdocs for MAC)

step3

 

 

STEP 4. After you have named your Site, you need to associate it to a local server. On the left hand side click on Servers. Then click on the + button to add a new server, as below:

step4

 

 

STEP 5. Set specs for your local server: start selecting the connection (Connect using) and set it to “Local/Network”

step5

 

 

STEP 6. Set Server Name, Folder, Web URL as below, then save

step 6

 

 

 

STEP 7. Back in the “Servers” menu, set your local server as a “Testing” server

step7

 

 

STEP 8. You can now edit your file in DW and click on “Preview” to see it in your browser. Do not forget you need to start your local server services or you will see an error like this:

step8

 

You are ready to start!

 

Set a new site in PHPstorm / WEBstorm

The process is very similar for any IDE. PHPstorm and WEBstorm work at the same way.

STEP 1: create your new folder in the root folder of your local server package (www for WAMP, htdocs for MAMP)

 

 

STEP 2: in PHPstorm home view, select “Create new project from existing files”:

 

STEP 3: select “Web server is installed locally… “

 

STEP 4: select the project folder and click on the “Project Root Folder” button, a new PHPstorm icon will appear close to selected folder:

 

STEP 5: specify existing / create a new local server :

 

STEP 6: specify parameters 

PC localhost/…/…

MAC localhost:8888/…/…

 

STEP 7: specify web path (if local server is already pointing to your project folder, you do not need to add anything)

 

 

STEP 8: setting is complete:

 

Happy coding!