2013-10-23

Setting up a WAMP-server (and how I got through all the issues)

So, I was in need of accessing a file through LAN in order to get my console to download a file from somewhere (and it only accepts URLs). So I thought that would be an easy fix with the help of a web-server through WAMP, since I had used that earlier without any issues.

Turns out some things have changed so here is my walkthrough (long wall of text with tons of steps) of what I experienced and how I solved the issues that arose, in case someone is running into same issue or if I need to do this again:

  1. Download & install latest WAMP-server for Win64 (as of today, that is: (64 BITS & PHP 5.4) 2.4)
  2. Launch wamp-server, LMB on icon and press "Put Online" and test "localhost" in browser (no response)
  3. Turns out port 80 is being used by skype, try to kill skype and try again (make sure it is working)
  4. Change port of wampserver to use 8080
    1. WAMP-icon/LMB/apache/httpd.conf
      1. Change "Listen 80" to "Listen 8080"
      2. Change ServerName-line to "ServerName localhost:8080"
      3. Restart Service
  5. Test again with http://localhost:8080/ (make sure it is working)
  6. Now next part, accessing a folder on server
    1. create a file in wamp-www-folder "c:\tools\wamp\www\temp\foobar.txt"
    2. should be able to navigate to it by typing "localhost:8080/temp/" in browser
  7. And finally, access the file through an IP-address (so you can access it from other device on your network)
    1. WindowsKey/cmd.exe/
      1. ipconfig <enter> (my ip is 10.20.201.75)
      2. Enter that IP into browser such as http://10.20.201.75:8080/temp/
        1. For me this resulted in an error with "you do not have permission to view this folder"
        2. Go into WAMP-icon/LMB/apache/httpd.conf
        3. Change <Directory "c:/tools/wamp/www"> ... </Directory> into:
          <Directory "c:/Tools/Wamp/www">
              Options Indexes FollowSymLinks MultiViews
              AllowOverride All
              Require all granted
          </Directory>
        4. (Basically it seems like all Allow-lines was changed in Apache 2.4 and thus they should be replaced by the Require all granted-line)
        5. At this point all should be working after a restart, but it wasn't for me, the apache-service stopped responding WAMP-icon/LMB/apache/service/"could not start service even after clicking on it several times) and there were no logs in apache_error.log.
          1. Windows-key/cmd/
          2. cd "C:\Tools\wamp\bin\apache\Apache2.4.4\bin\"
          3. httpd -t (will check configs to see if there is an error in a file, turns out I had an error in httpd.conf-file on a specific line which was reported by this command)
          4. Fixed issue in file and restarted service, working as intended
          5. You can also open TaskManager (ctrl+shift+escape)
            1. Services/wampapache and check status, for me it was stopped, which lead me to use the "httpd -t"-command
  8. Good Game - I win (finally able to download a file through console from a http-address)