Cursussen/Courses Codesnippets     Top 
PHP - Working environment


1. What is PHP?
On the website www.php.net PHP is described as follows: “PHP is a popular general-purpose scripting language that is especially suited for Web development.”
PHP is a scripting language that is mainly used in developing websites. You can insert PHP code in a web page between the HTML or you can generate HTML with PHP code.
An example:
<?php
   // mijn eerste programma
   echo "hallo wereld!<br>";
?>


2. Use
If you want to develop a dynamic and interactive website, you can use a scripting language. You then have the choice of using a scripting language on the “client” side or on the “server” side.
Javascript is an example of a scripting language that runs on the “client” side. The instructions are executed when the web page is loaded in the web browser (Google Chrome, Firefox, Opera, Safari, …) or when the user performs an action (for example, clicking a button in a form).
PHP code is processed on the “server” side. The web page is requested from the web server of your hosting provider. On this server, the PHP code in the web page is interpreted (by the PHP parser) and converted to HTML. The result is then sent back by the web server to your web browser which displays the page.
With PHP you can have input forms processed and the data stored in a database. You can upload files to your website, fill a photo album with your own photos, etc…
You can download additional documentation from the following website:
PHP documentation


3. Installation
To get started with PHP you need some programs. Of course you need the PHP program that you can download on the website PHP.net. It is best to get the most recent stable version.
In addition, you also need a web server (for example Apache) that is active on your PC (download via Apache.org). And if you also use a database in your programs, it is best to install a database program such as MySQL (download via MySQL.com).
You can also download a software package that contains the components mentioned above. An example of this is WampServer ( Wampserver ). This package contains PHP, Apache, MySQL, phpMyAdmin and some other interesting tools and examples.
You can find other packages on the Internet: EasyPHP (EasyPHP ), UwAmp (UwAmp ), etc…
Some packages are “portable”. You can download a zip file and extract it to a folder on the hard disk or on a memory stick. All you have to do is run the exe file. So you don't have to go through an installation procedure.
These packages serve to develop and test a website. For a production environment you can use the Linux programs (e.g. LAMP). Most websites are hosted on a Linux platform.


4. Editor
You can type in the PHP code with the editor of your choice. Some examples: PSPad, Editplus, Notepad++, Crimson editor, etc…
It is best to choose an editor that supports the scripting language because then specific functions of the editor can be used such as color indications, start and end marking indications, supplementing function descriptions, etc...
Notepad++ meets all conditions.