
mod_perl 1.0 User Guide Table of Contents: mod_perl 1.0 User Guide Deploying mod_perl technology to give rocket speed to your CGI/Perl scripts. Last modified Sun Feb 16 01:32:59 2014 GMT 15 Feb 2014 1 Table of Contents: Part I: Getting Started - 1. Getting Your Feet Wet This chapter gives you step-by-step instructions to get a basic statically-compiled mod_perl-enabled Apache server up and running. Having a running server allows you to experiment with mod_perl as you learn more about it. - 2. Introduction and Incentives An introduction to what mod_perl is all about, its different features, and some explanations of the C API, Apache::Registry, Apache::PerlRun, and the Apache/Perl API. - 3. mod_perl Installation An in-depth explanation of the mod_perl installation process, from the basic installation (in 10 steps), to a more complex one (with all the possible options you might want to use, including DSO build). It includes troubleshooting tips too. - 4. mod_perl Configuration This section documents the various configuration options available for Apache and mod_perl, as well as the Perl startup files, and more esoteric possibilites such as configuring Apache with Perl. Part II: Coding - 5. CGI to mod_perl Porting. mod_perl Coding guidelines. This chapter is relevant both to writing a new CGI script or perl handler from scratch and to migrat- ing an application from plain CGI to mod_perl. - 6. How to use mod_perl’s Method Handlers Described here are a few examples and hints on how to use method handlers with mod_perl. - 7. mod_perl and Relational Databases Creating dynamic websites with mod_perl often involves using relational databases. Apache::DBI, which provides a database connections persistence which boosts the mod_perl performance, is explained in this chapter. - 8. mod_perl and dbm files Small databases can be implemented pretty efficiently using dbm files, but there are still some precautions that must be taken to use them properly under mod_perl. - 9. Protecting Your Site Securing your site should be your first priority, because of the consequences a break-in might have. We discuss the various authentication and authorization techniques available, a very interesting use of mod_perl. - 10. Code Snippets A collection of mod_perl code snippets which you can either adapt to your own use or integrate directly into your own code. 2 15 Feb 2014 mod_perl 1.0 User Guide Table of Contents: - 11. Apache::* modules Overview of some of the most popular modules for mod_perl, both to use directly from your code and as mod_perl handlers. Part III: Advanced Setup and Performance - 12. Choosing the Right Strategy This document discusses various mod_perl setup strategies used to get the best performance and scal- ability of the services. - 13. Real World Scenarios This chapter provides a step-by-step installation guide for the various setups discussed in Choosing the Right Strategy. - 14. Performance Tuning An exhaustive list of various techniques you might want to use to get the most performance possible out of your mod_perl server: configuration, coding, memory use, and more. Part IV: Troubleshooting - 15. Frequent mod_perl problems Some problems come up very often on the mailing list. If there is some important problem that is being reported frequently on the list which is not included below, even if it is found elsewhere in the Guide, please report to mod_perl mailing list. - 16. Warnings and Errors Troubleshooting Index If you encounter an error or warning you don’t understand, check this chapter for solutions to common warnings and errors that the mod_perl community has encountered in the last few years. - 17. Debugging mod_perl Tired of Internal Server Errors? Find out how to debug your mod_perl applications, thanks to a number of features of Perl and mod_perl. - 18. Getting Help If your question isn’t answered by reading this guide, check this section for information on how to get help on mod_perl, Apache, or other topics discussed here. 15 Feb 2014 3 1 Getting Your Feet Wet 1 Getting Your Feet Wet 4 15 Feb 2014 Getting Your Feet Wet 1.1 Description 1.1 Description This chapter gives you step-by-step instructions to get a basic statically-compiled mod_perl-enabled Apache server up and running. Having a running server allows you to experiment with mod_perl as you learn more about it. (Of course, you’ll be experimenting on a private machine, not on a production server, right?) The remain- der of the guide, along with the documentation supplied with mod_perl, gives the detailed information required for fine-tuning your mod_perl-enabled server to deliver the best possible performance. Although there are binary distributions of mod_perl-enabled Apache servers available for various plat- forms, we recommend that you always build mod_perl from source. It’s simple to do (provided you have all the proper tools on your machine), and building from source circumvents possible problems with the binary distributions (such as the reported bugs with the RPM packages built for RedHat Linux). The mod_perl installation that follows has been tested on many mainstream Unix and Linux platforms. Unless you’re using a very non-standard system, you should have no problems when building the basic mod_perl server. For Windows users, the simplest solution is to use the binary package. Windows users may skip to the Installing mod_perl for Windows. 1.2 Installing mod_perl in Three Steps You can install mod_perl in three easy steps: Obtaining the source files required to build mod_perl, build- ing mod_perl, and installing it. Building mod_perl from source requires a machine with basic development tools. In particular, you will need an ANSI-compliant C compiler (such as gcc) and the make utility. All standard Unix-like distribu- tions include these tools. If a required tool is not already installed, then use the package manager that is provided with the system (rpm, apt, yast, etc.) to install them. A recent version of Perl is also required, at least version 5.004. Perl is available as an installable package, although most Unix-like distributions will have installed Perl by default. To check that the tools are avail- able and learn about their version numbers, try: % make -v % gcc -v % perl -v If any of these responds with Command not found, it will need to be installed. Once all the tools are in place the installation process can begin. Experienced Unix users will need no explanation of the commands that follow and can simply copy and paste them into a terminal window to get the server installed. 15 Feb 2014 5 1.3 Installing mod_perl for Unix Platforms Acquire the source code distrubutions of Apache and mod_perl from the Internet, using your favorite web browser or one of the command line clients like wget, lwp-download, etc. These two distributions are available from http://www.apache.org/dist/httpd/ and http://apache.org/dist/perl/. Remember that mod_perl 1.0 works only with Apache 1.3, and mod_perl 2.0 requires Apache 2.0. In this chapter we talk about mod_perl 1.0/Apache 1.3, hence the packages that you want are named apache_1.3.xx.tar.gz and mod_perl-1.xx.tar.gz, where xx should be replaced with the real version numbers of mod_perl and Apache. Move the downloaded packages into a directory of your choice, e.g., /home/stas/src/, proceed with the described steps and you will have mod_perl installed: % cd /home/stas/src % tar -zvxf apache_1.3.xx.tar.gz % tar -zvxf mod_perl-1.xx.tar.gz % cd mod_perl-1.xx % perl Makefile.PL APACHE_SRC=../apache_1.3.xx/src \ APACHE_PREFIX=/home/httpd DO_HTTPD=1 USE_APACI=1 EVERYTHING=1 % make && make test % su # make install That’s all! All that remains is to add a few configuration lines to the Apache configuration file, (/usr/local/apache/conf/httpd.conf), start the server, and enjoy mod_perl. The following detailed explanation of each step should help you solve any problems that may have arisen when executing the commands above. 1.3 Installing mod_perl for Unix Platforms Here is a more detailed explanation of the installation process, with each step explained in detail and with some troubleshooting advice. If the build worked and you are in a hurry to boot your new httpd, you may skip to the next section, talking about configuration of the server. Before installing Apache and mod_perl, you usually have to become root so that the files can be installed in a protected area. A user who does not have root access, however, can still install all files under their home directory. The proper approach is to build Apache in an unprivileged location and then only use root access to install it. We will talk about the nuances of this approach in the dedicated installation process chapter. 1.3.1 Obtaining and Unpacking the Source Code The first step is to obtain the source code distributions of Apache, available from http://www.apache.org/dist/httpd/ and mod_perl, available from http://apache.org/dist/perl/. Of course you can use your favorite mirror sites to get these distributions. 6 15 Feb 2014 Getting Your Feet Wet 1.3.2 Building mod_perl Even if you have the Apache server running on your machine, usually you need to download its source distribution, because you need to re-build it from scratch with mod_perl. The source distributions of Apache and mod_perl should be downloaded into directory of your choice. For the sake of consistency, we assume throughout the guide that all builds are being done in the /home/stas/src directory. However, using a different location is perfectly possible and merely requires changing this part of the path in the examples to the actual path being used.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages562 Page
-
File Size-