Configure Apache + mod_perl in Ubuntu

Source: Internet
Author: User
Tags perl interpreter
Why use mod_perl? One feature of the mod_perl module is that Apache modules can be written in Perl. Perl is an explanatory language, and its advantages and disadvantages coexist. One of the main advantages of an explanatory language is that this module does not need to be re-compiled every time the server is installed. The disadvantage is that an interpreter is needed to read and execute the actual program, which reduces the running speed of the server. by starting the Apache server while starting the Perl interpreter, in this way, mod_perl overcomes the slow speed problem.

Why use mod_perl?

One feature of the mod_perl module is that Apache modules can be written in Perl. Perl is an explanatory language, and its advantages and disadvantages coexist. One of the main advantages of an explanatory language is that this module does not need to be re-compiled every time the server is installed. The disadvantage is that an interpreter is needed to read and execute the actual program, which reduces the running speed of the server. by starting the Apache server while starting the Perl interpreter, in this way, mod_perl overcomes the slow speed problem. The Perl interpreter can also pre-interpret the Perl code on the server and capture it at any time so that the code can be executed quickly once it is used.

Install apache:

1. Download the apache installation package:

Https://launchpad.net/Ubuntu/+source/apache2/

2. decompress:

Tar zxvf apache *** .tar.gz

3: configuration parameters

./Configure-prefix =/usr/local/apache

4. make

5. make install

5. Start:

/Usr/local/apache/bin/apachectl start, which is used to enable apache

6. Start apache quickly and use vi ~ /. Run the bashrc command, and then enter alias apache = '/usr/local/apache/bin/apachectl ', in the future, you only need to enter the apache start | stop | restart command to control apache startup and shutdown.

7. automatically start Apache, vi/etc/rc at startup. d/rc. add the command/usr/local/apache/bin/apachectl start to start apache in local. After the Apache service is restarted, the apache service is automatically started.


Install mod_perl

1. in Linux, the perl environment is integrated by default.

Run the perl-version command to obtain the current perl version.

Therefore, apache in linux supports running perl Cgi by default. You have not enabled the configuration item.

Edit http. conf

Find # AddHandler cgi-script. cgi

Remove the front # and Add. pl after. cgi.

AddHandler cgi-script. cgi. pl

2. Download mod_perl from the http://perl.apache.org/download/index.html.

Http://ftp.nsysu.edu.tw/Ubuntu/ubuntu/pool/main/liba/ has various mod downloads

Decompress the downloaded .tar.gz file and run the installation command.

# Cd mod_perl-x.x.x

# Perl Makefile. PL

It will ask your apache apxs path

Please provide a full path to 'apxs 'executable
(Press Enter if you don't have it installed ):

Enter the complete path, for example/Usr/local/apache2/bin/apxs
After entering the information, press enter to scan your environment like configure compiled by the tar package.
And you are prompted to add it in httpd. conf.LoadModule perl_module modules/mod_perl.so

Don't worry, just compile and install it and add more! After the Wizard is complete, go to the current directory

# Make
# Make install

Done! You will find mod_perl.so in/usr/local/apache2/modules.
Now you can add the sentence in httpd. conf.

# Vi httpd. conf

Find# LoadModule foo_module modules/mod_foo.so
Add the following row
LoadModule perl_module modules/mod_perl.so

: Wq: Save and restart apache!

After mod_perl.so is loaded, apache's support for perl is even more powerful.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.