Page 37 - Open Soource Technologies 304.indd
P. 37

Open Source Technologies



                   Notes         Commands
                                 Special commands sent to the Apache server in the HTTP Header can be captured and handled
                                 with the function pointed to by this slot. These are typically used to configure the module before
                                 the associated registered hooks are called.
                                 Register Hooks
                                 This is a pointer to a function that details the hooks that this module handles. The convention
                                 is for the function to be called, of all things, ‘register_hooks’. There are lots and lots of potential
                                 hooks. We only needed one type, the ap_hook_handler.
                                 helloworld2_handler
                                 Our actual handler takes the form of:

                                        static int foobar_handler(request_rec *r)

                                 Where foobar is replaced with the name of the handler. Our first action in the handler is to set
                                 the return messages content type to ‘text/html’. We send the return header with:

                                         ap_send_http_header(r);
                                 Now we can send some text. In our case this is the ‘Hello’. We finish up by sending the macro OK.

                                 3.2 Choosing Appropriate Installation Method


                                 The Apache Web server is arguably the most popular Web server in use on the Internet today.
                                 Here are some of the reasons why Apache is so popular; you don’t have to be running Windows
                                 to  run  Apache.  It  was  developed  on  various  Unix/Linux/BSD  platforms,  and  then  recently
                                 ported to Win32. Internet Information Server, a Web server made by Microsoft for the Windows
                                 NT platform, is made for use in the “Windows-only” world. While IIS has many features, it’s
                                 lack of portability limits it’s market share. Another reason for Apache’s widespread acceptance
                                 is its overall stability. While you can slow down an Apache Web server, you can rarely, if ever,
                                 kill one. The Apache Web server service is near bulletproof.

                                 Apache has been shown to be substantially faster, more stable, and more feature-full than
                                 many  other  web  servers.  Although  certain  commercial  servers  have  claimed  to  surpass
                                 Apache’s speed (it has not been demonstrated that any of these “benchmarks” are a good
                                 way of measuring WWW server speed at any rate). The developers of Apache feel that it is
                                 better to have a mostly fast free server than an extremely fast server that costs thousands of
                                 dollars. Apache is run on sites that get millions of hits per day, and they have experienced no
                                 performance difficulties.

                                 3.2.1 Installation Options
                                 You can download Apache from the Apache Software Foundation web site located at
                                 http://www.apache.org, in source and binary forms. While your downloading Apache, you
                                 may want to browse over the documentation.
                                 3.2.2 What You Need

                                 To install Apache, you will need the following things:
                                    1.  A computer running Linux.




        32                                LOVELY PROFESSIONAL UNIVERSITY
   32   33   34   35   36   37   38   39   40   41   42