Practical PHP Tutorial - Configuration

Chapter 1
Editors
Text editors for php can be as simple as notepad and as sophisticated as Dreamweaver. Its you wish. But I prefer to use webmatrix by Microsoft or SublimeText. These are really simple to configure and you. Or you can use Notepad++. The latter is simply a syntax highlighter.

Servers
Configuring server is a process needed for running php. Php is server side language. We can use following servers that provide facilities to host php and render them.
XAMPP for Windows/Linux/Mac
XAMPP is a popular server, supports all platforms, that packages all that we require

  • PHP binaries -latest xampp has latest php binaries.
  • phpMyAdmin - that is used to manage the tables and databases in MySQL
  • MySQL - contains our databases
  • FileZilla - and FTP manager that required to upload file to server(not this local server, but to your domain).
Every prefers it as has everything in it by default. You can download it here.

WAMP Server
It is a sub package of xampp, but it is only for Windows. You can see X and W in the name that tells the platform. It has the same features and you can download it here.


IIS(Internet Information Services)
This is preinstalled product in Windows. Just go to "Turn Windows Features On or Off" in control panel and you can enable IIS there. But IIS by default doesn't support php, though it can readily support asp.
We have to install certain plugins to enable this feature in IIS: listed above in XAMPP. Yes, you have to manually install everything, if you don't prefer that package.

** - you have to paste the extracted files into root folder of IIS.

Root Folder
This folder is the root folder of the server. After installation of any of the server above, if you just go to your browser and type http://localhost/ or http://127.0.0.1/, you will land in the respective servers home pages. The following is the root folder for respective servers.
  • IIS - C:\inetpub\wwwroot\
  • XAMPP
    • Windows - C:\xampp\htdocs\
    • Linux - /opt/lampp/htdocs/
    • Mac - /Applications/xampp/htdocs/
  • WAMP - C:\wamp\www\

Starting the Server
The server should be running for you to execute the php script.
  • IIS - It is automatically started. In case it is not, go to Control Panel -> Administrative Tools -> Services and search for IIS and start it. If the mode is "manual" change it to "automatic".
  • WAMP - Go to wamp installation folder or start menu folder and click Start WAMP.
  • XAMPP
    • Windows - works like wamp
    • Linux - cd to /opt/lampp/ and execute "$ lampp start"
    • Mac - simply open XAMPP Control and start the server.
Testing the Server
We need check everything is so far right. So open a text editor (let me use windows conventions, you interpret to your OS accordingly), say, notepad and write the following peace of code in it.
<?php phpinfo(); ?>
Save that as something.php not as a txt or other file. Now put the file into the root folder of the respective server. Go to your browser and write http://localhost/something.php.
Now you should get some idea how it works. If everything goes alright you would see something like this...



If everything is fine lets get on to the coding part . . .

Comments

Popular posts from this blog

How to construct a B+ tree with example

How to show only month and year fields in android Date-picker?

Visitor Counter Script Using PHP