Apache install mod_perl2
Viewed 1k times. Ganesh Ganesh 2 2 gold badges 7 7 silver badges 23 23 bronze badges. Don't post screenshots of logs. Copy and paste the actual text. My guess is your Apache libraries are an incompatible version. Add a comment. Active Oldest Votes. This constant as been introduced in perl 5. Sorry, I don't have the reputation to comment, only answer. Ed Sabol Ed Sabol 2 2 silver badges 12 12 bronze badges.
Dave Cross Dave Cross Something must be wrong with your yum configuration. See mirror. Please update your question with details of the current situation — Dave Cross. First you have to decide where to install the modules. Actually we need only two directories:. We don't have to create them, since that will be done automatically when the first module is installed. Occasionally, when some module distribution comes with Perl scripts, these will go into the bin directory.
This directory will be created if it doesn't exist. Let's install the CGI. As usual, download the package from the CPAN repository, unpack it and chdir to the newly-created directory. Now do a standard perl Makefile. PL to prepare a Makefile , but this time tell MakeMaker to use your Perl installation directories instead of the defaults. Note that if you don't like how MakeMaker chooses the rest of the directories, or if you are using an older version of it which requires an explicit declaration of all the target directories, you should do this:.
Note that all the missing directories are created automatically, so there is no need to create them in first place. Here slightly edited is what it does :. Using this method you can easily maintain several Perl module repositories. For example, you could have one for production Perl and another for development:.
The output contains important information about your Perl installation. At the end you will see:. It shows us the content of the Perl special variable INC , which is used by Perl to look for its modules. It is equivalent to the PATH environment variable in Unix shells which is used to find executable programs. Notice that Perl looks for modules in the.
It's the last entry in the above output. Of course this example is from version 5. That's why you see ilinux and 5. If your system runs a different version of Perl, operating system, processor or chipset architecture, then some of the directories will have different names. Note that it's still Linux , but the newer Perl version uses the version of my Pentium processor thus the i and not i This makes use of compiler optimizations for Pentium processors when the binary Perl extensions are created.
Important: As we have installed the Perl modules into non-standard directories, we have to let Perl know where to look for the four directories. There are two ways to accomplish this. As mentioned before, you find the exact directories by executing perl -V and replacing the global Perl installation's base directory with your home directory.
Modifying INC is quite easy. The best approach is to use the lib module pragma , by adding the following snippet at the top of any of your scripts that require the locally installed modules. Also, notice that both approaches prepend the directories to be searched to INC.
This allows you to install a more recent module into your local repository and Perl will use it instead of the older one installed in the main system repository. Both approaches modify the value of INC at compilation time. Now, let's assume the following scenario. I have installed the LWP package in my local repository. Now I want to install another module e.
There is no way for Perl to know that we have some locally installed modules. All it does is search the directories listed in INC , and since the latter contains only the default four directories plus the. If you are using t? It should be a single line with directories separated by colons : and no spaces. If you are a ba? Again make it a single line. As with use lib , perl automatically prepends the architecture specific directories to INC if those exist. When you have done this, verify the value of the newly configured INC by executing perl -V as before.
You should see the modified value of INC :. When everything works as you want it to, add these commands to your. The next time you start a shell, the environment will be ready for you to work with the new Perl. But if for example someone else who doesn't have this setting in the shell tries to execute your scripts, Perl will fail to find your locally installed modules. As we saw in the section describing the usage of the CPAN.
It does the job for us, even detecting the missing modules listed in prerequisites, fetching and installing them. So you might wonder whether you can use CPAN.
When you start the CPAN interactive shell, it searches first for the user's private configuration file and then for the system wide one.
When I'm logged as user stas the two files on my setup are:. If there is no CPAN shell configured on your system, when you start the shell for the first time it will ask you a dozen configuration questions and then create the Config. If you have a different Perl version, alter the path to use your Perl's version number, when looking up the file.
Create the directory mkdir -p creates the whole path at once where the local configuration file will go:. The only thing left is to change the base directory of. I use Perl of course! Now you have the local configuration file ready, you have to tell it what special parameters you need to pass when executing the perl Makefile. PL stage.
Now you've finished the configuration. Assuming that you are logged in as the same user you have prepared the local installation for stas in our example , start it like this:. From now on any module you try to install will be installed locally. If you need to install some system modules, just become the superuser and install them in the same way.
When you are logged in as the superuser, the system-wide configuration file will be used instead of your local one. For example if you have used these variables:. Just like with Perl modules, if you don't have permissions to install files into the system area you have to install them locally under your home directory.
It's almost the same as a plain installation, but you have to run the server listening to a port number greater than since only root processes can listen to lower numbered ports. Another important issue you have to resolve is how to add startup and shutdown scripts to the directories used by the rest of the system services. You will have to ask your system administrator to assist you with this issue. To install Apache locally, all you have to do is to tell.
If you want to see what they are, before you proceed add the --show-layout option:. Also remember that you can start the script only under a user and group you belong to. You must set the User and Group directives in httpd. It's almost as simple as doing each one separately, but there is one wrinkle you need to know about which I'll mention at the end of this section.
The following commands will do that for you:. If you need some parameters to be passed to the. For example:. Note that the above multiline splitting will work only with ba? Basically the installation is complete. The only remaining problem is the INC variable. This won't be correctly set if you rely on the PERL5LIB environment variable unless you set it explicitly in a startup file which is require 'd before loading any other module that resides in your local repository. As a result, INC will be reset to its original value after the scripts are compiled and the hard-coded settings will be forgotten.
The only place you can alter the "original" value is during the server configuration stage either in the startup file or by putting. Another important thing to keep in mind is the consumption of system resources. You have a few options:. Reduce resources usage see Preventing Your Processes from Growing.
Ask your ISP's system administrator whether they can setup a dedicated machine for you, so that you will be able to install as much memory as you need. If you get a dedicated machine the chances are that you will want to have root access, so you may be able to manage the administration yourself. Then you should consider keeping on the list of the system administrator's responsibilities the following items: a reliable electricity supply and network link.
And of course making sure that the important security patches get applied and the machine is configured to be secure. Finally having the machine physically protected, so no one will turn off the power or break it. You can find a list of these ISPs on this site.
Again, CPAN makes installation and upgrades simpler. You have seen how to install Perl modules and Apache locally. Assuming that you have configured CPAN. Start the CPAN. When you use CPAN. The simplest way to do this is to quit the interactive shell by typing quit and reenter it. But if you insist here is how to make it work without quitting the shell. You really want to skip this :. Save this value:.
You can add parameters to this line, or remove them, according to your needs. Not so neat, but a working solution. Source is downloaded from the Internet, compiled, and the resulting system is installed in the directory you specify.
There are a few ways. Now you should use httpd -l. Knowing the port you have configured apache to listen on, you can use telnet to talk directly to it.
You will find configuration assistance at ModPerlConfiguration. Copy and paste the script below no need for a shebang line! Let's say you name it test. Make it readable and executable by server you may need to tune these permissions on a public host :. You should see something like this the output has been edited :. If there is an error you might have to add a shebang line!
If you see:. You might wonder why in the world you would need to know what handler you are running under. Note that if you run scripts under the Apache::Registry handler, it takes care of overriding the exit call for you, so it's not an issue. Yet another one. Why do I show all these approaches? While here they serve a very simple purpose, they can be helpful in other situations. Will show you all the headers. The -d option disables printing the response content.
Specify the port number if your server is listening to a port other than port This technique works only if ServerTokens directive is set to Full or not specified in httpd.
That's because this directive controls whether the components information is displayed or not. The answer is No. The reason is that you can't "suid" a part of a process. Another solution is to use a crontab to call some script that will check whether there is something to do and will execute it. Yes, you should. This points to the old Perl and it is probably linked to an old libperl library.
If for some reason you need to keep the old Perl version around you can modify INC in the startup script, but it is better to build afresh to save you getting into a mess. Make sure you have Perl installed! The latest stable version if possible. Minimum perl 5. If you don't have it, install it. During the configuration stage while running.
When Perl is configured it attempts to find libraries for ndbm, gdbm, db, etc. By default, these libraries are linked with Perl and remembered by the Config module. However, the order in which these libraries are stored in Config. If -lgdbm or -ldb is before -lndbm as it is in the example edit Config. Here's how to find Config. As you install each they typically overwrite each other's config. Save them after each step, so you will be able to reuse them later.
All Perl modules that use C extensions must be compiled using the same compiler that your copy of Perl was built with and the same compile options. When you run perl Makefile. PL , a Makefile is created. This Makefile includes the same compilation options that were used to build Perl itself.
They are stored in the Config. All these options are re-applied when compiling Perl modules. If you use a different compiler to build Perl extensions, chances are that the options that a different compiler uses won't be the same, or they might be interpreted in a completely different way.
So the code either won't compile or it will dump core when run or maybe it will behave in most unexpected ways. You shouldn't worry about this when compiling Perl modules since Perl will choose what's right automatically.
Unless you override things. If you do that, you are on your own Similarly, if you compile a non-Perl component separately, you should make sure to use both the same compiler and the same options used to build Perl. Starting from 1. It turns out that they use argv[0] to determine where to find the link tables at run-time, so if a program either changes argv[0] , or does a chdir like Apache!
The short-term solutions to the problem are simple. Either of the following will work:. Don't use a relative path!
As of Apache 1. The server package is more flexible at run-time because the actual server process can be assembled at run-time via LoadModule httpd. The server package can be easily extended with third-party modules even after installation. For example if you set in httpd. Alternatively we could configure this section to do:. See PerlOpenLogsHandler. See PerlPostConfigHandler. See PerlChildInitHandler. See PerlChildExitHandler. See PerlPreConnectionHandler.
See PerlProcessConnectionHandler. See PerlInputFilterHandler. See PerlOutputFilterHandler. See PerlSetInputFilter. See PerlTransHandler. See PerlInitHandler. See PerlHeaderParserHandler. See PerlAccessHandler. See PerlAuthenHandler. See PerlAuthzHandler. See PerlTypeHandler. See PerlFixupHandler. See PerlResponseHandler. See PerlLogHandler. See PerlCleanupHandler. The minimum number of available interpreters this parameter will clone interpreters up to PerlInterpMax , before a request comes in.
The maximum number of requests an interpreter should serve, the interpreter is destroyed when the number is reached and replaced with a fresh clone. If you wish to override settings, unset any previous setting by assigning 0 zero , like so:. You can't mix the number 0 with letters, it must be alone. These directives can also appear in. Also see Stacked Handlers. Inside httpd.
The configuration inside IfDefine will have an effect. If you want to have some configuration section to have an effect if a certain define wasn't defined use! For example in a startup file you can say:. You can always adjust contents of INC before the server starts.
There are several ways to do that. In the startup file you can use the lib pragma like so:. In httpd. Use it only if you know what you are doing. This technique works under any MPM with ithreads-enabled perl. It's just that under prefork your procs will be huge, because you will build a pool of interpreters in each process. While the same happens under threaded mpm, there you have many threads per process, so you need just 1 or 2 procs and therefore less memory will be used.
Have comments? Please send them to the modperl users mailing list. Success Stories. Reporting Bugs. Getting Help. Mailing Lists. Site Map. Maillist Subscription. Maillist Archives. The source. The 1. Starting with 2. Migrating to 2. Report 1. Report 2.
0コメント