Home Tutorial PHP Lesson 01 - Installing a Server



MSN Random Online

Lesson 01 - Installing a Server PDF Print E-mail
Written by Administrator   
Thursday, 15 February 2007 18:13

Lesson 01 - Installing a Server

The reason I want to have people set up their own local servers (in windows) is because it makes testing your scripts so much easier.  With a local server, there is no need to upload anything anywhere, your script can be edited and tested on the spot.  To keep with the flow of simplicity with these tutorials, I've decided not to make everyone download every single component to make their own server.  Instead I've decided to get everyone to download an all-in-one package that will install the server for you :), no fuss.

You will all need to download and install the file located at:
http://www.easyphp.org/telechargements/dn.php?F=easyphp1-6.php3

EasyPHP will install apache, php, mySQL, and phpMyAdmin all for you with a few simple clicks.  The program itself is originally in French, and the installation is all in French, but it's just a matter of clicking "yes", "Suivant", "Oui", "Suivant", "Suivant", "Installer", and let it install.

You should now have installed the EasyPHP server on your computer.

To begin testing it you can do the following:
Click on Start > Programs > EasyPHP > click on the easy shortcut EasyPHP

You should see a big E in your system tray and a blinking red dot.  If the red dot isn't blinking, right-click on the E and click on "start".  The red dot should NOW be blinking if it wasn't earlier.  Right-click on the E again and click on "configuration".  The textbox at the bottom where it says "mySQL arguments" should be changed to "--skip-name-resolve --language=english" (replaced "french" with "english").

All the files you want to test should be placed in the following directory:
C:\Program Files\EasyPHP\www

Start by placing the following file in there (you don't need to know what this does right now):
phpinfo.php

Code:
<? echo phpinfo(); ?>

If your server is running (the little red dot on the E should be flashing), then you can open up the browser of your choice and go to this URL:
http://127.0.0.1/phpinfo.php

If you see HTML, and information pertaining to PHP, then congratulations, you've got a local server running on your computer.

Let's test something else, phpMyAdmin.  phpMyAdmin, if you don't already know, is a frontend for mySQL in PHP which allows you to work with tables and databases.  Try going to the following URL and see whether you see HTML or not:
http://127.0.0.1/mysql/

If you saw HTML and not some error, then this test has also passed and you've got yourself a little server to test your scripts on.  A few notes:

All scripts you create will go in the "C:\Program Files\EasyPHP\www" directory.  To see your scripts you have to go to the following URL: "http://127.0.0.1/(your filename here)".

A few examples:
To edit: C:\Program Files\EasyPHP\www\file.php
To test: http://127.0.0.1/file.php

To edit: C:\Program Files\EasyPHP\www\new directory\file.php
To test: http://127.0.0.1/new%20directory/file.php (the %20 should be added automatically by your browser, a space is sufficient)

Other side notes:
You can create your PHP scripts in any simple text editor which won't add formatting like notepad or wordpad.  Your PHP files MUST have a "php" extension.

 

 
 

Top Members

No top members yet.