MoonFacedAssassin's Journal http://www.slashcode.com/~MoonFacedAssassin/journal/ MoonFacedAssassin's Slashcode Journal en-us Copyright 2004, OSTG - Open Source Technology Group, Inc. All Rights Reserved. 2012-01-25T04:40:37+00:00 Me admins@slashcode.com Technology hourly 1 1970-01-01T00:00+00:00 MoonFacedAssassin's Journal http://images.slashcode.com/topics/topicslash.gif http://www.slashcode.com/~MoonFacedAssassin/journal/ PHP with Apache and Mod Perl http://www.slashcode.com/~MoonFacedAssassin/journal/239?from=rss For others and so I have a log myself here's how I got PHP to work with mod_perl and apache:<br> <br> Here are the versions of software I used:<blockquote><div><p>Apache 1.3.27<br> Mod Perl 1.27<br> PHP 4.3.0</p></div> </blockquote><p> The following needs to be done first so PHP's<nobr> <wbr></nobr>./configure doesn't complain:<br> In Apache directory:</p><blockquote><div><p>./configure --prefix=<b>&lt;path to apache install&gt;</b> --activate-module=src/modules/php4/libphp4.a --activate-module=src/modules/perl/libperl.a</p></div> </blockquote><p> In PHP directory:</p><blockquote><div><p>./configure --with-mysql=<b>&lt;path to mysql install&gt;</b> --with-apache=<b>&lt;path to apache root source&gt;</b> --enable-track-vars<br><nobr> <wbr></nobr>./make<br><nobr> <wbr></nobr>./make install</p></div> </blockquote><p> In mod_perl directory:<br> Edit the Makefile.PL file and look for the line (was line number 1029 for me) that has the following:</p><blockquote><div><p>$cmd<nobr> <wbr></nobr>.= "./configure " . "--activate-module=src/modules/perl/libperl.a";</p></div> </blockquote><p> Add this to the end of the quotes (but before the semi-colon):</p><blockquote><div><p> . " --activate-module=src/modules/php4/libphp4.a"</p></div> </blockquote><p> Save this file and now run this:</p><blockquote><div><p>perl Makefile.PL APACHE_SRC=<b>&lt;path to apache root source&gt;</b> DO_HTTPD=1 USE_APACI=1 PERL_MARK_WHERE=1 EVERYTHING=1 APACHE_PREFIX=<b>&lt;path to apache install&gt;</b></p></div> </blockquote><p> The output of the perl command should be something like this:</p><blockquote><div><p>Will configure via APACI<br> cp apaci/Makefile.libdir<nobr> <wbr></nobr>../apache_1.3.27/src/modules/perl/Makefile.libdir<nobr> <wbr></nobr> <br> cp apaci/Makefile.tmpl<nobr> <wbr></nobr>../apache_1.3.27/src/modules/perl/Makefile.tmpl<br> cp apaci/README<nobr> <wbr></nobr>../apache_1.3.27/src/modules/perl/README<br> cp apaci/configure<nobr> <wbr></nobr>../apache_1.3.27/src/modules/perl/configure<br> cp apaci/libperl.module<nobr> <wbr></nobr>../apache_1.3.27/src/modules/perl/libperl.module <br><nobr> <wbr></nobr> cp apaci/mod_perl.config.sh<nobr> <wbr></nobr>../apache_1.3.27/src/modules/perl/mod_perl.config<nobr>.<wbr></nobr> sh<br> cp apaci/load_modules.pl<nobr> <wbr></nobr>../apache_1.3.27/src/modules/perl/load_modules.pl<nobr> <wbr></nobr> <br> cp apaci/find_source<nobr> <wbr></nobr>../apache_1.3.27/src/modules/perl/find_source<br> cp apaci/apxs_cflags<nobr> <wbr></nobr>../apache_1.3.27/src/modules/perl/apxs_cflags<br> cp apaci/perl_config<nobr> <wbr></nobr>../apache_1.3.27/src/modules/perl/perl_config<br> cp apaci/mod_perl.exp<nobr> <wbr></nobr>../apache_1.3.27/src/modules/perl/mod_perl.exp<br> PerlDispatchHandler.........enabled<br> PerlChildInitHandler........enabled<br> PerlChildExitHandler........enabled<br> PerlPostReadRequestHandler..enabled<br> PerlTransHandler............enabled<br> PerlHeaderParserHandler.....enabled<br> PerlAccessHandler...........enabled<br> PerlAuthenHandler...........enabled<br> PerlAuthzHandler............enabled<br> PerlTypeHandler.............enabled<br> PerlFixupHandler............enabled<br> PerlHandler.................enabled<br> PerlLogHandler..............enabled<br> PerlInitHandler.............enabled<br> PerlCleanupHandler..........enabled<br> PerlRestartHandler..........enabled<br> PerlStackedHandlers.........enabled<br> PerlMethodHandlers..........enabled<br> PerlDirectiveHandlers.......enabled<br> PerlTableApi................enabled<br> PerlLogApi..................enabled<br> PerlUriApi..................enabled<br> PerlUtilApi.................enabled<br> PerlFileApi.................enabled<br> PerlConnectionApi...........enabled<br> PerlServerApi...............enabled<br> PerlSections................enabled<br> PerlSSI.....................enabled<br> PERL_MARK_WHERE.............enabled (experimental)<br> Will run tests as User: 'nobody' Group: 'root'<br> (cd<nobr> <wbr></nobr>../apache_1.3.27 &amp;&amp; CC="gcc" CFLAGS=" -DPERL_MARK_WHERE=1 -D_REENTRANT -fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdb<br> m"<nobr> <wbr></nobr>./configure --activate-module=src/modules/perl/libperl.a --activate-module=src/modules/php4/libphp4.a --disable-rule=EXPAT --prefix=/home/justin/tempapach<br> e)<br> Configuring for Apache, Version 1.3.27<br> + using installation path layout: Apache (config.layout)<br> + activated perl module (modules/perl/libperl.a)<br> + activated php4 module (modules/php4/libphp4.a)<br> Creating Makefile<br> Creating Configuration.apaci in src<br> + id: mod_perl/1.27<br> + id: Perl/v5.8.0 (linux) [/usr/bin/perl]<br> Creating Makefile in src<br> + configured for Linux platform<br> + setting C pre-processor to gcc -E<br> + checking for system header files<br> + adding selected modules<br> o perl_module uses ConfigStart/End<br> + mod_perl build type: OBJ<br> + setting up mod_perl build environment<br> + adjusting Apache build environment<br> + enabling Perl support for SSI (mod_include)<br> o php4_module uses ConfigStart/End<br> + checking sizeof various data types<br> + doing sanity check on compiler and options<br> Creating Makefile in src/support<br> Creating Makefile in src/os/unix<br> Creating Makefile in src/ap<br> Creating Makefile in src/main<br> Creating Makefile in src/modules/standard<br> Creating Makefile in src/modules/perl<br> Creating Makefile in src/modules/php4<br> Checking CGI.pm VERSION..........ok<br> Checking for LWP::UserAgent......ok<br> Checking for HTML::HeadParser....ok<br> Writing Makefile for Apache<br> Writing Makefile for Apache::Connection<br> Writing Makefile for Apache::Constants<br> Writing Makefile for Apache::File<br> Writing Makefile for Apache::Leak<br> Writing Makefile for Apache::Log<br> Writing Makefile for Apache::ModuleConfig<br> Writing Makefile for Apache::PerlRunXS<br> Writing Makefile for Apache::Server<br> Writing Makefile for Apache::Symbol<br> Writing Makefile for Apache::Table<br> Writing Makefile for Apache::URI<br> Writing Makefile for Apache::Util<br> Writing Makefile for mod_perl</p></div> </blockquote><p> Take note of these two lines:</p><blockquote><div><p> + activated perl module (modules/perl/libperl.a)<br> + activated php4 module (modules/php4/libphp4.a)</p></div> </blockquote><p> If those two lines are present then both php and mod_perl will be staticly linked in apache (i.e. no DSO involved)<br> <br> Now in mod_perl directory:</p><blockquote><div><p>./make<br><nobr> <wbr></nobr>./make install</p></div> </blockquote><p> The<nobr> <wbr></nobr>./make should compile mod_perl and php into apache (basically by running apache's Makefiles) and then<nobr> <wbr></nobr>./make install will install apache into the APACHE_PREFIX specified earlier.<br> <br> Now edit httpd.conf and add or uncomment this line:</p><blockquote><div><p>AddType application/x-httpd-php<nobr> <wbr></nobr>.php<nobr> <wbr></nobr>.php3<nobr> <wbr></nobr>.phtml</p></div></blockquote><p> Now install Slash (and whatever perl modules are necessary). Don't forget to copy PHP's php.ini file to<nobr> <wbr></nobr>/usr/local/lib and edit it as necessary.</p> MoonFacedAssassin 2003-01-03T19:50:51+00:00 apache