190 likes | 207 Vues
WampServer 2 Installation. WAMP is a solution stack of open source programs used together to run dynamic Web sites or servers Most common expansion: W indows, A pache Web server; M ySQL database management system (or database server) P HP server-side scripting language
E N D
WampServer 2 Installation • WAMP is a solution stack of open source programs used together to run dynamic Web sites or servers • Most common expansion: • Windows, • Apache Web server; • MySQL database management system (or database server) • PHP server-side scripting language • “P” may also refer to Perl or Python • WampServer 2 is the latest version (recently “2” was dropped)
Downloading and Setup • If you’ve already installed Apache2 or MySQL, make sure they’re • stopped and • restarted manually • Click the sequence Start Control Panel Administrative Tools Services • Double click on the line for Apache2 (or MySQL) • In the resulting window, change • Service status to Stopped (click the Stop button) and • Startup type to Manual (using drop-down menu) • Click OK • You must stop anything else (e.g., Skype) running on port 80
To download WampServer 2, go to http://www.wampserver.com/en/download.php • An .exe file • Download wizard automatically sets up all 3 programs • Suggested installation folder is C:\wamp • During installation, asked whether you want these services • started up when the machine starts up (i.e., AutoStart) or • started manually • Latter preferred (security and performance)
A folder directly below the installation folder is www • Default document root—accept this default • When client requests a document from your Web site, root of the path in the URL is this folder, C:\wamp\www • E.g. if the domain name is myName.myDomain.com, then a request for http://myName.myDomain.com/first.html locates C:\wamp\www\first.html • A request http://myName.myDomain.com/thisProject/second.php locates C:\wamp\www\thisProject\second.php
The URL contains forward-slashes (/) where Windows uses backslashes (\) • Server automatically converts
When asked for the PHP mail parameters (SMTP server), • enter SMTP server for PHP to send emails • then click Next • For this class, use A&T server, smtp.ncat.edu • When asked for default email address to send emails, • enter you’re A&T email address, astudent@aggies.ncat.edu • then click Next • When asked for your default browser, • accept the default (e.g., firefox.exe) or • choose from the File name popup menu • Then click Open • Finally, click Finish
Now modify PATH system environment variable (if you want to run MySQL from the command line) • Append to the end of the value (if it isn’t already there) ";C:\wamp\bin\mysql\mysqlxxxxx\bin" (The xxxxx is the version info. Go to the folder and find what it is.) • If you were exposing your website to the public, you’d also password protect your MySQL installation
After installing WampServer2, there’s a WampServer2 icon on bottom right toolbar (or the popup there) • If things are okay, it’s green—else yellow or (if something fails) red • Moving mouse cursor over it results in a message saying whether the services are online or offline • Clicking on the icon pops up the menu at right
Starting Services and Leaving Apache Offline • For Apache server to respond to requests, must be started • (For the MySQL server to function, it too must be started) • During installation, asked whether server is to be started automatically when you boot • For performance and security, choose manually • (In any case, if you stop the servers, must restart them manually) • To start Apache server (and MySQL server) manually, in the popup menu shown above, click Start All Services
Can also start the servers from the Start menu: StartAll ProgramsWampServer, and click start WampServer • The WampServer icon changes color from magenta to green • The server needn’t be online for our purposes • In fact it should not be online (security)
For security and performance, when you no longer want the services, • click Stop All Services • If text appearing when mouse cursor moves over WampServer icon indicates one of the services is still running, • click Stop All Services again
Test the Apache Installation • With all services running • Open your browser • Put in the address bar http://localhost/ • Click the Go button • Or click Localhost in the popup you get by clicking the WAMP icon • On the next slide, see rendering of the document produced by C:\wamp\www\index.php
Under Tools, phpinfo() shows the configuration • Including where the configuration file is located • phpmyadmin is a very convenient interface to the MySQL databases • Also available through the popup menu • Under Your Projects are listed the folders under C:\wamp\www • I.e., under the document root • Click on one to go to that folder • See the figure
Clicking on an .html file in such a folder will cause the server to execute it • You can’t otherwise click on the file’s icon and have the server execute it (rather than the browser render it) • The alternative is to type http://localhost/... in the address bar of your browser • For this class, all server-side access will be to localhost • Programming is then simple, all on your machine • E.g., have the server serve C:\wamp\www\c322f09\name.html put in the address bar http://localhost/c322f09/name.html • Recall that C:\wamp\www\ is the document root • Same effect by going via Your Projects and clicking the icon
Can open your browser with http://localhost/ in the address bar by clickomg Localhost in the popup window • Then complete the address as desired
If Installation Fails • If, when trying to connect with http://localhost/, you don’t see the rendering shown 4 slides back (but, e.g., get a message that the server can’t be accessed), something’s wrong • Make sure there are no problems with port 80—see screenshot • In the WampServer popup, put the mouse cursor over Apache • In the resulting popup, put the mouse cursor over Service • In the next popup, select Test Port 80 • Should see what’s shown in the screenshot • If not, either stop what now has the port or (if nothing has) you know Apache isn’t starting properly
Look at the Apache error log—see the screenshot • In the WampServer popup, put the mouse cursor over Apache • In the resulting popup, select Apache error log • Look for an error that should be fatal • Copy the description (on the right end of the line reporting the error) • Google it • Almost certainly others experienced the same error, and some documented the solution
If you’re getting nowhere, uninstall WampServer and install it again • There’s no Uninstall WampServer option in the WampServer menu • In the WampServer popup, select Stop All Services • Right click the WampServer icon • In the resulting popup, click Exit • Save the contents under your document root (usually C:\wamp\www\) somewhere if you’ve already added to it • Execute the file C:\wamp\unins000.exe • You will still have a (mostly empty) folder C:\wamp (and a few mostly empty subfolders) • Remove these