| Home | The latest: The sample PHP web page under #18 below was updated. | See http://www.php.net/docs.php for complete PHP programming documentation. |

Tutorial: How to Test PHP Web Pages Offline Using XAMPP Lite

By Howard Charles Best, August 4, 2008

(LLBest.com, )

Updated: May 4, 2011

Note: This implementation of the Apache server is called XAMPP Lite for Windows. It is completely portable, in other words, no installation is required, and it will even work on a flash drive.

Note: These instructions should work on any stand-alone (no Internet connection necessary once the software is downloaded) Windows 98 or later computer, but so far I've only tested them on Windows XP and Windows 7 computers. This tutorial assumes that extensions for known file types are not hidden. (1. Click Start. 2. Click Computer. 3. Click Organize. 4. Click Folder and search options…. 5. Click the View tab. 6. Make sure that Hide extensions for known file types is unchecked. 7. Click OK. 8. Close the Computer window.)

1. Go to http://www.apachefriends.org/en/xampp-windows.html#646, click EXE and download xampplite-win32-….exe to your desktop. (Right now it’s a 25.7MB file called xampplite-win32-1.7.2.exe.)

2. Double-click the xampplite-win32-….exe icon.

3. Let the Destination folder default to C:\.

4. Click the install button.

5. xampplite-win32-….exe may now be deleted.

6. Move the xampplite folder to the root directory of your hard drive.*

7. Within the xampplite folder, double click apache_start.bat.

8. You should then get a window that says, among other things, Apache could not be started.

9. Close the window.

10. Double click setup_xampp.bat.

11. Then answer the prompts as follows:

Screen capture of XAMPPlite setup

Screen capture of XAMPPlite setup

Screen capture of XAMPPlite setup

12. Double click apache_start.bat again.

13. This time, you should see:

Screen capture of XAMPPlite starting up

Hint: For the sake of convenience, create shortcuts to apache_start.bat and apache_stop.bat on your desktop.

Hint: To save time and trouble, comment out the PAUSE statement in apache_start.bat and apache_stop.bat. For example:

14. Click: http://localhost/xampp/index.php and then English, and you should see the following:

Screen capture of XAMPPlite welcome screen

15. Click Status, and you should see:

Screen capture of XAMPPlite status screen

16. Inside the xampplite\htdocs folder, create a new folder called MWS (my websites).

17. Inside the xampplite\htdocs\MWS folder, create a new folder called test.com (an example of one of your websites).

18. Using Notepad, create a text file called index.php in the xampplite\htdocs\MWS\test.com folder, and put the following into it:

19. Click: http://localhost/MWS/test.com/.

20. PHP Example should appear in the middle of your web browser window!

21. Bookmark it, or save it as one of your Favorites.

22. To close down the Apache server, double click apache_stop.bat.

23. You might want to put shortcuts to apache_start.bat and apache_stop.bat on your desktop.

TESTING PERL CGI WEB PAGES

1. Go to http://www.activestate.com/Products/ActivePerl/.

2. Download ActivePerl for Windows.

3. Install ActivePerl. (It will, by default, be installed into a folder named C:/Perl.)

4. Rename the C:/Perl folder to C:/usr.

5. Then .cgi web pages beginning with:

…, which is the usual way to do it on the Internet, will also work on your stand-alone computer when the XAMPP Lite Apache server is running.

Note: Click here for more details on how to install Perl.

CREATING A CUSTOM 404 ERROR WEB PAGE

If you enter a URL into your web browser which does not exist, you will normally get a 404 Not Found error. However, some website hosting services allow your to create a file named missing.html in the root directory of your website. The purpose of this file is to provide a custom response to a 404 Not Found error. This can also be accomplished offline using the XAMPP Lite Apache server as follows:

1. Create a web page named:

F:\xampplite\htdocs\MWS\missing.html to handle the 404 errors.

2. Use Notepad to edit a file named:

C:\xampplite\apache\conf\extra\httpd-multilang-errordoc.conf.

3. Change:

… to the following:

4. Save the changes, and then the next time that you bring up XAMPP Lite, and enter a http://localhost/… URL which does not exist, instead of getting a 404 Not Found error web page, your missing.html web page will be loaded.

* If you want an extremely convenient way to test your websites on multiple computers, then put the xampplite folder in the root directory of a flash drive. The reason for putting it in the root directory is that the flash drive might not always have the same drive letter which means that you will have to again double click setup_xampp.bat, which works more reliably when the xampplite folder is in the root directory.


| Home | THIS WEB PAGE URL: http://LLBest.com/?P=69 |