wamp windows apache mysql and php i.e. “wamp”. why wamp? wampserver is a windows web development...

14
WAMP Windows Apache MySQL and PHP i.e. “WAMP”

Upload: marion-lang

Post on 20-Jan-2016

264 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: WAMP Windows Apache MySQL and PHP i.e. “WAMP”. Why WAMP? WampServer is a Windows web development environment. It allows you to create and test web pages

WAMP

Windows Apache MySQL and PHPi.e. “WAMP”

Page 2: WAMP Windows Apache MySQL and PHP i.e. “WAMP”. Why WAMP? WampServer is a Windows web development environment. It allows you to create and test web pages

Why WAMP?• WampServer is a Windows web development

environment. It allows you to create and test web pages and applications using a local server: Apache2. It also handles server-side scripting: PHP and MySQL databases (alongside a database admin panel: PhpMyAdmin).

• You can test web pages (especially with PHP) safely before they go live, and as it saves you a lot of time in the long run.

• You can configure Dreamweaver Site with WAMP as the local testing server.

Page 3: WAMP Windows Apache MySQL and PHP i.e. “WAMP”. Why WAMP? WampServer is a Windows web development environment. It allows you to create and test web pages

www.wampserver.com/en/• Download (use a reliable source! See header above)

and install WAMP (normally install to C:\wamp directory). Read instructions carefully.

Page 4: WAMP Windows Apache MySQL and PHP i.e. “WAMP”. Why WAMP? WampServer is a Windows web development environment. It allows you to create and test web pages

Completing installation

Page 5: WAMP Windows Apache MySQL and PHP i.e. “WAMP”. Why WAMP? WampServer is a Windows web development environment. It allows you to create and test web pages

• Look for the green WAMP logo/icon in the bottom right of the task bar area:

• If it is red or orange it is not working fully.

• To start either right click it or go to Start > Programs > WampServer > Start WampServer

• Open a web browser and type localhost, or left click the Wamp logo and click local host

Check Server is running

Page 6: WAMP Windows Apache MySQL and PHP i.e. “WAMP”. Why WAMP? WampServer is a Windows web development environment. It allows you to create and test web pages

Type the URL “http://localhost”• You should see this in the web browser. This

normally means the server is running properly. “Locahost” is the server name.

Page 7: WAMP Windows Apache MySQL and PHP i.e. “WAMP”. Why WAMP? WampServer is a Windows web development environment. It allows you to create and test web pages

Add a project• Navigate to the www folder in the WAMP folder on

the C: drive, or where you installed it, e.g.

C:\wamp\www

• To add a project, create a new folder (the name of the folder becomes the project, e.g.

C:\wamp\www\pageboutique

Page 8: WAMP Windows Apache MySQL and PHP i.e. “WAMP”. Why WAMP? WampServer is a Windows web development environment. It allows you to create and test web pages

Refresh locahost• Your folder has

been added to the list of projects. Place web pages in this folder. One file should be named index.html to act as the default homepage.

Page 9: WAMP Windows Apache MySQL and PHP i.e. “WAMP”. Why WAMP? WampServer is a Windows web development environment. It allows you to create and test web pages

Wamp Settings• Locate the file http.conf to change settings of the

web server (Apache server). You edit it in Notepad, but always keep a back up of the original in case!

Page 10: WAMP Windows Apache MySQL and PHP i.e. “WAMP”. Why WAMP? WampServer is a Windows web development environment. It allows you to create and test web pages

Changing WAMP settings• Changing the WAMP settings may be useful later

when you become more acquainted with the software, however you should be able to leave the settings as they are.

• Changing the settings is not recommended unless you make a backup of the settings files.

• The following example discusses how you can add additional host names such as client1, client2, etc. to the standard host name localhost

• In order to change some files, you may need to set permissions in security to do so

Page 11: WAMP Windows Apache MySQL and PHP i.e. “WAMP”. Why WAMP? WampServer is a Windows web development environment. It allows you to create and test web pages

Example of WAMP SettingsSay you are a freelance web designer using your laptop as a local development machine. You would like to create more than one virtual host for each client. You will need to modify 2 files. Here is an example how to do it (based on a Windows 32 bit OS). Use Notepad or a text editor to modify files. Create a back up of any modified files in case you need to revert back. You may need to access Permissions (Security settings to modify the hosts file)

1. Find the hosts file, e.g. in: c:\windows\system32\drivers\etc\ and modify the file hosts (see next slide)

2. Find and modify the Apache configuration file httpd.conf in: httpd.conf file:, e.g. (see following slides)

C:\wamp\bin\apache\Apache2.4.4\conf

Page 12: WAMP Windows Apache MySQL and PHP i.e. “WAMP”. Why WAMP? WampServer is a Windows web development environment. It allows you to create and test web pages

Change the hosts file• The hosts files has entries which maps IP Address to a name. By default the name

“localhost” is mapped to 127.0.0.1, e.g.127.0.0.1 localhost

• Add additional entries to represent your clients/projects. You may use the name of the client as the mapping key, e.g.

127.0.0.1 client1.local 127.0.0.1 client2

127.0.0.1 client3 etc.Add (using Notepad) as many entries as you want in the hosts file. Whenever you enter “client1” or “client2” in your web browser, windows will first look into hosts file and if it gets the corresponding entry, it sends the request to that IP Address. You may need to type http:// before client name

Page 13: WAMP Windows Apache MySQL and PHP i.e. “WAMP”. Why WAMP? WampServer is a Windows web development environment. It allows you to create and test web pages

Change the httpd.conf file1. Open the httpd.conf file and search (CTRL+F) for the line:

DocumentRoot "c:/wamp/www“Add the source code below under the line DocumentRoot “c :/wamp/www” (assuming your clients are called client1 and client2 and there is a client1 and client2 folder in the WAMP www folder

NameVirtualHost 127.0.0.1<VirtualHost 127.0.0.1> ServerName localhost DocumentRoot 'C:\wamp\www'</VirtualHost><VirtualHost 127.0.0.1> ServerName client1 DocumentRoot 'C:\wamp\www\client1'</VirtualHost><VirtualHost 127.0.0.1> ServerName client2 DocumentRoot 'C:\wamp\www\client2'</VirtualHost>

Page 14: WAMP Windows Apache MySQL and PHP i.e. “WAMP”. Why WAMP? WampServer is a Windows web development environment. It allows you to create and test web pages

Restart WAMP• When making changes to the system files http.conf

and hosts, you need to restart the WAMP server. Left click the green WAMP icon in the taskbar and select Restart all Services.

• Test the new local server addresses.