apache+php+mysql+perl安装详解

安装环境: FreeBSD 5.2.1
所需软件:
mysql-4.1.10a.tar.gz
php-4.3.10.tar.gz
apache_1.3.31.tar.gz
mod_perl-1.29.tar.gz
mod_ssl-2.8.18-1.3.31.tar.gz
openssl-0.9.7d.tar.gz
perl-5.8.3.tar.gz

安装步骤:
代码:

tar xzvf apache_1.3.31.tar.gz
tar xzvf mod_perl-1.29.tar.gz
tar xzvf mod_ssl-2.8.18-1.3.31.tar.gz
tar xzvf openssl-0.9.7d.tar.gz
tar xzvf perl-5.8.3.tar.gz

cd openssl-0.9.7d
./config
make
make test
make install

安装perl
代码:

tar xzvf perl-5.8.3.tar.gz
sh Configure -de
make
make test
make install

cd mod_ssl-2.8.18-1.3.31
./configure --with-apache=../apache_1.3.31 --with-ssl=../openssl-0.9.7d

cd mod_perl-1.29
perl Makefile.PL APACHE_SRC=../apache_1.3.31/src USE_APACI=1 USE_DSO=0 EVERYTHING=1 NO_HTTPD=1 PREP_HTTPD=1
make
make install



安装apache
代码:

cd apache_1.3.31
SSL_BASE=../openssl-0.9.7d /
./configure --prefix=/usr/local/apache /
--activate-module=src/modules/perl/libperl.a /
--enable-shared=max --disable-shared=perl /
--enable-module=all --enable-module=ssl --enable-suexec /
--suexec-caller=www
make
make install

安装mysql
代码:

tar xzvf mysql-4.1.10a.tar.gz
cd mysql-4.1.10a
./configure --prefix=/usr/local/mysql --with-mysqld-user=mysql /
--without-bench --without-debug ---with-extra /
charsets=complex --with-mysqld-ldflags=-all-static
make
make install
./scripts/mysql_install_db
chown -R mysql:mysql /usr/local/mysql/var
chmod -R g+rx /usr/local/mysql/var
chmod -R o+rx /usr/local/mysql/var


安装php
代码:

php_version=4.3.10
php_prefix=/usr/local/php

for name in apache cgi; do
  tar zxf php-${php_version}.tar.gz
  mv php-${php_version} php-${php_version}-${name}
done


# Apache
(cd php-${php_version}-apache &&
 ./configure /
  --prefix=${php_prefix} /
  --with-apxs=/usr/local/modperl/bin/apxs /
  --with-mysql=/usr/local/mysql /
  --with-gd=/usr/local /
  --enable-versioning /
  --enable-mbstring /
  --enable-mbstr-enc-trans /
  --enable-mbregex && /
 make && /
 make install && /
 [ -f ${php_prefix}/lib/php.ini ] || /
   cp php.ini-dist ${php_prefix}/lib/php.ini)

# CGI
(cd php-${php_version}-cgi &&
 ./configure /
  --prefix=${php_prefix} /
  --enable-force-cgi-redirect /
  --with-mysql=/usr/local/mysql /
  --with-gd=/usr/local /
  --enable-versioning /
  --enable-mbstring /
  --enable-mbstr-enc-trans /
  --enable-mbregex && /

make
make install
遇到问题及解决方法1:
1,编译perl模块时出现如下错误:
#perl Makefile.PL APACHE_SRC=../apache_1.3.31/src USE_APACI=1 USE_DSO=$_MOD_PERL_DSO EVERYTHING=1 NO_HTTPD=1 PREP_HTTPD=1
Will configure via APACI
Configure mod_perl with ../apache_1.3.31/src ? [y] y
cp apaci/Makefile.libdir ../apache_1.3.31/src/modules/perl/Makefile.libdir
cp apaci/Makefile.tmpl ../apache_1.3.31/src/modules/perl/Makefile.tmpl
cp apaci/README ../apache_1.3.31/src/modules/perl/README
cp apaci/configure ../apache_1.3.31/src/modules/perl/configure
cp apaci/libperl.module ../apache_1.3.31/src/modules/perl/libperl.module
cp apaci/mod_perl.config.sh ../apache_1.3.31/src/modules/perl/mod_perl.config.sh
cp apaci/load_modules.pl ../apache_1.3.31/src/modules/perl/load_modules.pl
cp apaci/find_source ../apache_1.3.31/src/modules/perl/find_source
cp apaci/apxs_cflags ../apache_1.3.31/src/modules/perl/apxs_cflags
cp apaci/perl_config ../apache_1.3.31/src/modules/perl/perl_config
cp apaci/mod_perl.exp ../apache_1.3.31/src/modules/perl/mod_perl.exp
PerlDispatchHandler.........enabled
PerlChildInitHandler........enabled
PerlChildExitHandler........enabled
PerlPostReadRequestHandler..enabled
PerlTransHandler............enabled
PerlHeaderParserHandler.....enabled
PerlAccessHandler...........enabled
PerlAuthenHandler...........enabled
PerlAuthzHandler............enabled
PerlTypeHandler.............enabled
PerlFixupHandler............enabled
PerlHandler.................enabled
PerlLogHandler..............enabled
PerlInitHandler.............enabled
PerlCleanupHandler..........enabled
PerlRestartHandler..........enabled
PerlStackedHandlers.........enabled
PerlMethodHandlers..........enabled
PerlDirectiveHandlers.......enabled
PerlTableApi................enabled
PerlLogApi..................enabled
PerlUriApi..................enabled
PerlUtilApi.................enabled
PerlFileApi.................enabled
PerlConnectionApi...........enabled
PerlServerApi...............enabled
PerlSections................enabled
PerlSSI.....................enabled
Will run tests as User: 'nobody' Group: 'wheel'
Checking CGI.pm VERSION..........ok
Checking for LWP::UserAgent......failed
Can't locate LWP/UserAgent.pm in @INC (@INC contains: ./lib /usr/local/lib/perl5/site_perl/5.005/i386-freebsd /usr/local/lib/perl5/site_perl/5.005 . /usr/libdata/perl/5.00503/mach /usr/libdata/perl/5.00503) at Makefile.PL line 1157.

The libwww-perl library is needed to run the test suite.
Installation of this library is recommended, but not required.

Checking for HTML::HeadParser....failed
Can't locate HTML/HeadParser.pm in @INC (@INC contains: ./lib /usr/local/lib/perl5/site_perl/5.005/i386-freebsd /usr/local/lib/perl5/site_perl/5.005 . /usr/libdata/perl/5.00503/mach /usr/libdata/perl/5.00503) at Makefile.PL line 1175.

The HTML-Parser package is needed (by libwww-perl) to run the test suite.
Checking if your kit is complete...
Looks good
Writing Makefile for Apache
Writing Makefile for Apache::Connection
Writing Makefile for Apache::Constants
Writing Makefile for Apache::File
Writing Makefile for Apache::Leak
Writing Makefile for Apache::Log
Writing Makefile for Apache::ModuleConfig
Writing Makefile for Apache::PerlRunXS
Writing Makefile for Apache::Server
Writing Makefile for Apache::Symbol
Writing Makefile for Apache::Table
Writing Makefile for Apache::URI
Writing Makefile for Apache::Util
Writing Makefile for mod_perl
#
解决方法:
下载并安装
HTML-Tagset-3.04
HTML-Parser-3.45
如果需要的模块特别多,可以通过CPAN安装perl模块,方法如下:
#perl -MCPAN -e shell

/usr/local/lib/perl5/5.8.6/CPAN/Config.pm initialized.


CPAN is the world-wide archive of perl resources. It consists of about
100 sites that all replicate the same contents all around the globe.
Many countries have at least one CPAN site already. The resources
found on CPAN are easily accessible with the CPAN.pm module. If you
want to use CPAN.pm, you have to configure it properly.

If you do not want to enter a dialog now, you can answer 'no' to this
question and I'll try to autoconfigure. (Note: you can revisit this
dialog anytime later by typing 'o conf init' at the cpan prompt.)

Are you ready for manual configuration? [yes]


The following questions are intended to help you with the
configuration. The CPAN module needs a directory of its own to cache
important index files and maybe keep a temporary mirror of CPAN files.
This may be a site-wide directory or a personal directory.



First of all, I'd like to create this directory. Where?

CPAN build and cache directory? [/root/.cpan]


If you want, I can keep the source files after a build in the cpan
home directory. If you choose so then future builds will take the
files from there. If you don't want to keep them, answer 0 to the
next question.



How big should the disk cache be for keeping the build directories
with all the intermediate files?

Cache size for build directory (in MB)? [10]


By default, each time the CPAN module is started, cache scanning
is performed to keep the cache size in sync. To prevent from this,
disable the cache scanning with 'never'.

Perform cache scanning (atstart or never)? [atstart]


To considerably speed up the initial CPAN shell startup, it is
possible to use Storable to create a cache of metadata. If Storable
is not available, the normal index mechanism will be used.

Cache metadata (yes/no)? [yes]


The next option deals with the charset your terminal supports. In
general CPAN is English speaking territory, thus the charset does not
matter much, but some of the aliens out there who upload their
software to CPAN bear names that are outside the ASCII range. If your
terminal supports UTF-8, you say no to the next question, if it
supports ISO-8859-1 (also known as LATIN1) then you say yes, and if it
supports neither nor, your answer does not matter, you will not be
able to read the names of some authors anyway. If you answer no, names
will be output in UTF-8.

Your terminal expects ISO-8859-1 (yes/no)? [yes]


If you have one of the readline packages (Term::ReadLine::Perl,
Term::ReadLine::Gnu, possibly others) installed, the interactive CPAN
shell will have history support. The next two questions deal with the
filename of the history file and with its size. If you do not want to
set this variable, please hit SPACE RETURN to the following question.

File to save your history? [/root/.cpan/histfile]
Number of lines to save? [100]


The CPAN module can detect when a module that which you are trying to
build depends on prerequisites. If this happens, it can build the
prerequisites for you automatically ('follow'), ask you for
confirmation ('ask'), or just ignore them ('ignore'). Please set your
policy to one of the three values.

Policy on building prerequisites (follow, ask or ignore)? [ask]


The CPAN module will need a few external programs to work properly.
Please correct me, if I guess the wrong path for a program. Don't
panic if you do not have some of them, just press ENTER for those. To
disable the use of a download program, you can type a space followed
by ENTER.

Where is your gzip program? [/usr/bin/gzip]
Where is your tar program? [/usr/bin/tar]
Warning: unzip not found in PATH
Where is your unzip program? []
Where is your make program? [/usr/bin/make]
Warning: lynx not found in PATH
Where is your lynx program? []
Warning: wget not found in PATH
Where is your wget program? []
Warning: ncftpget not found in PATH
Where is your ncftpget program? []
Warning: ncftp not found in PATH
Where is your ncftp program? []
Where is your ftp program? [/usr/bin/ftp]
Warning: gpg not found in PATH
Where is your gpg program? []
What is your favorite pager program? [more]
What is your favorite shell? [/bin/csh]


Every Makefile.PL is run by perl in a separate process. Likewise we
run 'make' and 'make install' in processes. If you have any
parameters (e.g. PREFIX, LIB, UNINST or the like) you want to pass
to the calls, please specify them here.

If you don't understand this question, just press ENTER.

Parameters for the 'perl Makefile.PL' command?
Typical frequently used settings:

PREFIX=~/perl non-root users (please see manual for more hints)

Your choice: []
Parameters for the 'make' command?
Typical frequently used setting:

-j3 dual processor system

Your choice: []
Parameters for the 'make install' command?
Typical frequently used setting:

UNINST=1 to always uninstall potentially conflicting files

Your choice: []


Sometimes you may wish to leave the processes run by CPAN alone
without caring about them. As sometimes the Makefile.PL contains
question you're expected to answer, you can set a timer that will
kill a 'perl Makefile.PL' process after the specified time in seconds.

If you set this value to 0, these processes will wait forever. This is
the default and recommended setting.

Timeout for inactivity during Makefile.PL? [0]


If you're accessing the net via proxies, you can specify them in the
CPAN configuration or via environment variables. The variable in
the $CPAN::Config takes precedence.

Your ftp_proxy?
Your http_proxy?
Your no_proxy?
You have no /root/.cpan/sources/MIRRORED.BY
I'm trying to fetch one
LWP not available
CPAN: Net::FTP loaded ok
Fetching with Net::FTP:
ftp://ftp.perl.org/pub/CPAN/MIRRORED.BY
Couldn't fetch MIRRORED.BY from
ftp.perl.org
Fetching with Net::FTP
ftp://ftp.perl.org/pub/CPAN/MIRRORED.BY.gz
Couldn't fetch MIRRORED.BY.gz from
ftp.perl.org
Issuing "/usr/bin/ftp -n"
Trying 161.53.30.181...
Connected to
ftp.cpan.ddns.develooper.com.
220 Welcome to the
ftp.linux.hr FTP service.
331 Please specify the password.
230-
230-Ovo je
ftp.linux.hr, FTP posluzitelj Hrvatske Udruge Linux Korisnika.
230-
230-Pogledajte README datoteku za opis sadrzaja na nasem posluzitelju.
230-
230-CD ISO imagei su na iso.linux.hr!
230-
230- --
ftpadmin@linux.hr
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
Local directory now /root/.cpan/sources
250 Directory successfully changed.
250 Directory successfully changed.
250 Directory successfully changed.
200 Switching to Binary mode.
local: MIRRORED.BY remote: MIRRORED.BY
229 Entering Extended Passive Mode (|||47677|)
150 Opening BINARY mode data connection for MIRRORED.BY (159338 bytes).
100% |****************************************************************************************************| 155 KB 38.58 KB/s 00:00 ETA
226 File send OK.
159338 bytes received in 00:04 (33.90 KB/s)
221 Goodbye.
GOT /root/.cpan/sources/MIRRORED.BY


Now we need to know where your favorite CPAN sites are located. Push
a few sites onto the array (just in case the first on the array won't
work). If you are mirroring CPAN to your local workstation, specify a
file: URL.

First, pick a nearby continent and country (you can pick several of
each, separated by spaces, or none if you just want to keep your
existing selections). Then, you will be presented with a list of URLs
of CPAN mirrors in the countries you selected, along with previously
selected URLs. Select some of those URLs, or just keep the old list.
Finally, you will be prompted for any extra URLs -- file:, ftp:, or
http: -- that host a CPAN mirror.


(1) Africa
(2) Asia
(3) Central America
(4) Europe
(5) North America
(6) Oceania
(7) South America
Select your continent (or several nearby continents) [] 2
Sorry! since you don't have any existing picks, you must make a
geographic selection.

(1) China
(2) Hong Kong
(3) India
(4) Indonesia
(5) Iran
(6) Israel
(7) Japan
(Cool Malaysia
(9) Philippines
(10) Republic of Korea
(11) Russian Federation
(12) Saudi Arabia
(13) Singapore
(14) Taiwan
(15) Thailand
(16) Turkey
Select your country (or several nearby countries) [] 1
Sorry! since you don't have any existing picks, you must make a
geographic selection.

(1)
ftp://mirrors.hknet.com/CPAN
(2)
http://cpan.linuxforum.net/
(3)
http://mirrors.dayouit.com/CPAN/
Select as many URLs as you like (by number),
put them on one line, separated by blanks, e.g. '1 4 5' [] 2

Enter another URL or RETURN to quit: []
New set of picks:
http://cpan.linuxforum.net/


commit: wrote /usr/local/lib/perl5/5.8.6/CPAN/Config.pm
Terminal does not support AddHistory.

cpan shell -- CPAN exploration and modules installation (v1.7601)
ReadLine support available (try 'install Bundle::CPAN')

cpan>

OK,出现上面的"cpan>"就可以使用了,操作方法:
获得帮助 
cpan>h 

列出CPAN上所有模块的列表 
cpan>m 

安装模块,如安装DBI. 
cpan>install DBI 
自动完成DBI模块从下载到安装的全过程。 

退出 
cpan>q 

如果CPAN无法使用,出现如下错误
You have no /root/.cpan/sources/MIRRORED.BY
I'm trying to fetch one

Please, install Net::FTP as soon as possible. CPAN.pm installs it for you
if you just type
install Bundle::libnet

Issuing "/usr/bin/ftp -n"
ftp: connect: Operation timed out
Not connected.
Local directory now /root/.cpan/sources
Not connected.
Not connected.
Not connected.
Not connected.
Not connected.
Bad luck... Still failed!
Can't access URL
ftp://ftp.perl.org/pub/CPAN/MIRRORED.BY.

Please check, if the URLs I found in your configuration file () are valid.
The urllist can be edited. E.g. with ``o conf urllist push
ftp://myurl/''

Cannot fetch MIRRORED.BY

Couldn't open : No such file or directory at /usr/libdata/perl/5.00503/CPAN/FirstTime.pm line 417, <STDIN> chunk 22.
#

没有办法只有下载安装libnet-1.19.tar.gz,然后在运行CPAN了.

2,网页无法打开,查看日志如下:
[Wed Feb 22 21:20:19 2006] [error] Can't locate HTML/Template.pm in @INC (@INC contains: /usr/local/kablog/lib /usr/local/lib/perl5/site_perl/5.8.2/mach /usr/local/lib/perl5/site_perl/5.8.2 /usr/local/lib/perl5/site_perl/5.6.1 /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.8.2/BSDPAN /usr/local/lib/perl5/5.8.2/mach /usr/local/lib/perl5/5.8.2 . /usr/local/modperl/ /usr/local/modperl/lib/perl) at /usr/local/kablog/exec/siteInfo line 10./nBEGIN failed--compilation aborted at /usr/local/kablog/exec/siteInfo line 10./n

解决方法:
由于缺少perl相关模块HTML-Template-2.7.tar.gz
安装模块即可.
安装方法:
tar xzvf HTML-Template-2.7.tar.gz
cd HTML-Template-2.7
perl Makefile.PL
make
make test
make install

当然也可以向我在楼上提到的CPAN的方法安装.

3,启动apache时出现如下错误提示:
#/usr/local/modperl/bin/apachectl start
Syntax error on line 16 of /usr/local/modperl/conf/misc.conf:
Can't locate Apache/DBI.pm in @INC (@INC contains: /usr/local/lib/perl5/site_perl/5.005/i386-freebsd /usr/local/lib/perl5/site_perl/5.005 . /usr/libdata/perl/5.00503/mach /usr/libdata/perl/5.00503 /usr/local/modperl/ /usr/local/modperl/lib/perl) at (eval 3) line 3.

/usr/local/modperl/bin/apachectl start: httpd could not be started
#

原因缺少perl模块,下载并安装Apache-DBI-0.9901.tar.gz,也可以通过CPAN安装,问题解决.

 
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值