You will need to host a sample website for the hands-on lab. The sample PHP web pages will be provided during the session.
You can host the site in your local server (localhost) if you already have one configured on your computer. You can also use an online web-host if you have access to. Skip this Exercise in that case.
The following steps will guide you install a local web-server on your computer.
Successfully Download and install a local-server software. Verify access to their default home page in your web browser.
We will use XAMPP in this example. XAMPP is a very easy to install Apache Distribution of Linux, Solaris, Windows, and Mac OS X. The package includes the Apache web server, MySQL, PHP, Perl, an FTP server and phpMyAdmin. With that, you can have fun with your own website/scripting experiments in future with XAMPP on your machine.
(Alternatively, you can choose to install any popular package such as LAMP, WAMP, MAMP etc.)
- Download latest XAMPP software from: https://www.apachefriends.org/download.html
- Install with default settings. Just notice the directory where it’s getting installed (e.g. C:\XAMPP)
- After install, open the “XAMPP Control” app in your computer. Then start “Apache”:
- Apache server should start with default ports: 80/443:
That’s your local web-server switched On!
- Troubleshooting: If Apache could not start on default ports, probably something (e.g. IIS, Skype etc.) was blocking/using the default ports.
Consider changing the ports configured for Apache (try using some other ports e.g. 88 and 488). You can do that by clicking on “Config” and then editing and saving the files: httpd.conf and httpd-ssl.conf:
In those configuration files, find the line that mentions Listening on the ports (80 in httpd.conf and 443 in httpd-ssl.conf) and change those numbers (you can try 88 and 444 respectively).
After you save those two configuration files. Re-start with Step#3 (Starting Apache)
- After a successful start of Apache, in your browser, type “localhost” as the URL and proceed. If you had used a port other than the default, you will need to add the port number to the URL separated by colon e.g. “localhost:88“
You should be redirected to XAMPP Dashboard and see a welcome page like this:
(with default settings)
(with HTTP port changed to 88)
- Locate your XAMPP install directory in your computer. You should see a sub-directory “htdocs“:
Your websites and web pages usually reside in that
sub-directory. We will come back to this during the Lab.