Search This Blog

Showing posts with label apache. Show all posts
Showing posts with label apache. Show all posts

Friday, October 2, 2009

Apache vs Nginx : Web Server Performance Deathmatch

Deathmatch may be an overstatement but here are the results from some performance benchmarking.

The Setup:

Server:

  • CENTOS 5.1
  • Dual 2.4GHz Xeon CPUs
  • 4GB RAM
  • RAID5 (4 x 15k disks)
  • Server and test client were connected via a consumer grade 10/100 switch

Configurations:

  • Basic static vhost
  • Keepalive turned on and with timeout of 15 seconds
  • GZIP turned on

I used autobench to perform the tests. Basically this is a perl script that sits on top of httperf and will run multiple tests in succession outputing the results to CSV. Awfully convenient.

All the tests were run against the same robots.txt file. Autobench ran the following command 20 times incrementing the request rate by 10 each time. I started at 10 requests per second and went up to 200.

httperf –timeout=5 –client=0/1 –server=HOST –port=80 –uri=/robots.txt –rate=X –send-buffer=4096 –recv-buffer=16384 –num-conns=5000 –num-calls=10

I performed two samples and arbitrarily used the second as the results shown here. At the bottom of this post I will have spreadsheet containing the data from these tests so you can check out all the results.

The Results:

Both web servers performed well in all the tests and had no issues completing the requests. So I will not mention the metrics that they finished very closely on, only the ones that they did not have similar results.

There were three httperf related tests that Nginx and Apache differed on more than small amount, reply rate, network I/O and response time.

This one really piqued my interest. It seems strange to me why we would see such a result from Apache. In both tests there was a big difference at the 700 request mark. Statistically the difference was only on the max reply rate. The average and minimum are within a few tenths of a percent consistent through the tests. The max for Apache in the first test was 734.7 and in the second 758.7, standard deviations of 13.9 and 22.9 respectively. I suppose the real question here is whether or not this is my test or how Apache acts. If it is the later it seems strange that dealing with 700 requests would be any different than dealing with 800. From 800 requests to 2000, the larger differences in these results seems more realistic, controlled and gradual.

The network I/O graph I find interesting mostly because I don’t know how to take it. On one hand it seems Apache is simply using more bandwidth to do the same number of requests as Nginx. Which would seem bad. On the other it could just mean that Apache does a better job of consuming and using the available pipe. Which would seem good. My hunch is that it is the former.

The response times are also interesting since Nginx responds consistently at 0.4 ms. I am not sure why this is since I don’t know the internals to Nginx but I imagine that it is something that is built into how it deals with requests.

While the httperf tests were running I collected sar data from that time. The results show that Nginx uses a good amount less CPU and produces equally less load.

Apache:

CPU:

Load:

Nginx:

CPU:

Load:

Thats all I got, pretty cool. Nginx seems to compete pretty well with Apache and there doesn’t seem like there is a good reason not to use it especially in CPU usage constrained situations (ie huge traffic, slow machines and etc).

Here’s my results spreadsheet for the detailed results of each httperf metric.

Wednesday, June 10, 2009

Install Configure Apache Localhost Perl on Linux Ubuntu

This article teaches those who want to run Perl scripts from browser on Ubuntu Linux with Apache HTTP Server.

1. First, you need to install apache2 by executing the following command from the terminal:

sudo apt-get install apache2

2. Now you can install mod_perl by executing the following command from the terminal:

apt-get install libapache2-mod-perl2

3. If you know how to set up a local server directory to let files like example.html running from browser like http://localhost/example.html or you previously installed LAMP, then you can read on, if not, please read this article first before continue.

4. Now you may need to edit Apache Configuration file in order to tell Apache Perl where your .pl script is located, so that the server can execute it as Perl script. So let’s say if you put your Perl script example.pl inside a folder located at your defined local server directory for instance /home/shi/Documents/Host/perl/example.pl, you need to open apache2.conf:

sudo gedit /etc/apache2/apache2.conf

add in the code:
view source
print?
01.Alias /perl/ /home/shi/Documents/Host/perl/
02.
03.PerlModule ModPerl::Registry
04.
05.
06. SetHandler perl-script
07. PerlHandler ModPerl::Registry
08. #PerlHandler ModPerl::PerlRun
09. Options +ExecCGI
10. #PerlSendHeader On
11.

(change the line /home/shi/Documents/Host/perl/ to your server directory name)

And now restart your server by running the following command in terminal:

sudo /etc/init.d/apache2 restart

Now write a test.pl file with the test script below:

#!/usr/bin/perl
use CGI;
my $query= new CGI;
print $query->header;
print "hello people in my head\n";

set the test.pl file permission to 755 and put it in your local server directory and type the url path in the browser and you should see the message: ‘hello people in my head’.

Friday, June 5, 2009

apxs - APache eXtenSion tool

apxs is a tool for building and installing extension modules for the Apache HyperText Transfer Protocol (HTTP) server. This is achieved by building a dynamic shared object (DSO) from one or more source or object files which then can be loaded into the Apache server under runtime via the LoadModule directive from mod_so.

So to use this extension mechanism your platform has to support the DSO feature and your Apache httpd binary has to be built with the mod_so module. The apxs tool automatically complains if this is not the case. You can check this yourself by manually running the command

$ httpd -l

The module mod_so should be part of the displayed list. If these requirements are fulfilled you can easily extend your Apache server's functionality by installing your own modules with the DSO mechanism by the help of this apxs tool:

$ apxs -i -a -c mod_foo.c
gcc -fpic -DSHARED_MODULE -I/path/to/apache/include -c mod_foo.c
ld -Bshareable -o mod_foo.so mod_foo.o
cp mod_foo.so /path/to/apache/modules/mod_foo.so
chmod 755 /path/to/apache/modules/mod_foo.so
[activating module `foo' in /path/to/apache/etc/httpd.conf]
$ apachectl restart
/path/to/apache/sbin/apachectl restart: httpd not running, trying to start
[Tue Mar 31 11:27:55 1998] [debug] mod_so.c(303): loaded module foo_module
/path/to/apache/sbin/apachectl restart: httpd started
$ _

The arguments files can be any C source file (.c), a object file (.o) or even a library archive (.a). The apxs tool automatically recognizes these extensions and automatically used the C source files for compilation while just using the object and archive files for the linking phase. But when using such pre-compiled objects make sure they are compiled for position independent code (PIC) to be able to use them for a dynamically loaded shared object. For instance with GCC you always just have to use -fpic. For other C compilers consult its manual page or at watch for the flags apxs uses to compile the object files.

For more details about DSO support in Apache read the documentation of mod_so or perhaps even read the src/modules/standard/mod_so.c source file.

top

Synopsis

apxs -g [ -S name=value ] -n modname

apxs -q [ -S name=value ] query ...

apxs -c [ -S name=value ] [ -o dsofile ] [ -I incdir ] [ -D name=value ] [ -L libdir ] [ -l libname ] [ -Wc,compiler-flags ] [ -Wl,linker-flags ] files ...

apxs -i [ -S name=value ] [ -n modname ] [ -a ] [ -A ] dso-file ...

apxs -e [ -S name=value ] [ -n modname ] [ -a ] [ -A ] dso-file ...

top

Options

Common Options

-n modname
This explicitly sets the module name for the -i (install) and -g (template generation) option. Use this to explicitly specify the module name. For option -g this is required, for option -i the apxs tool tries to determine the name from the source or (as a fallback) at least by guessing it from the filename.

Query Options

-q
Performs a query for apxs's knowledge about certain settings. The query parameters can be one or more of the following strings: CC, CFLAGS, CFLAGS_SHLIB, INCLUDEDIR, LD_SHLIB, LDFLAGS_SHLIB, LIBEXECDIR, LIBS_SHLIB, SBINDIR, SYSCONFDIR, TARGET.

Use this for manually determining settings. For instance use

INC=-I`apxs -q INCLUDEDIR`

inside your own Makefiles if you need manual access to Apache's C header files.

Configuration Options

-S name=value
This option changes the apxs settings described above.

Template Generation Options

-g
This generates a subdirectory name (see option -n) and there two files: A sample module source file named mod_name.c which can be used as a template for creating your own modules or as a quick start for playing with the apxs mechanism. And a corresponding Makefile for even easier build and installing of this module.

DSO Compilation Options

-c
This indicates the compilation operation. It first compiles the C source files (.c) of files into corresponding object files (.o) and then builds a dynamically shared object in dsofile by linking these object files plus the remaining object files (.o and .a) of files. If no -o option is specified the output file is guessed from the first filename in files and thus usually defaults to mod_name.so.
-o dsofile
Explicitly specifies the filename of the created dynamically shared object. If not specified and the name cannot be guessed from the files list, the fallback name mod_unknown.so is used.
-D name=value
This option is directly passed through to the compilation command(s). Use this to add your own defines to the build process.
-I incdir
This option is directly passed through to the compilation command(s). Use this to add your own include directories to search to the build process.
-L libdir
This option is directly passed through to the linker command. Use this to add your own library directories to search to the build process.
-l libname
This option is directly passed through to the linker command. Use this to add your own libraries to search to the build process.
-Wc,compiler-flags
This option passes compiler-flags as additional flags to the libtool --mode=compile command. Use this to add local compiler-specific options.
-Wl,linker-flags
This option passes linker-flags as additional flags to the libtool --mode=link command. Use this to add local linker-specific options.

DSO Installation and Configuration Options

-i
This indicates the installation operation and installs one or more dynamically shared objects into the server's modules directory.
-a
This activates the module by automatically adding a corresponding LoadModule line to Apache's httpd.conf configuration file, or by enabling it if it already exists.
-A
Same as option -a but the created LoadModule directive is prefixed with a hash sign (#), i.e., the module is just prepared for later activation but initially disabled.
-e
This indicates the editing operation, which can be used with the -a and -A options similarly to the -i operation to edit Apache's httpd.conf configuration file without attempting to install the module.
top

Examples

Assume you have an Apache module named mod_foo.c available which should extend Apache's server functionality. To accomplish this you first have to compile the C source into a shared object suitable for loading into the Apache server under runtime via the following command:

$ apxs -c mod_foo.c
/path/to/libtool --mode=compile gcc ... -c mod_foo.c
/path/to/libtool --mode=link gcc ... -o mod_foo.la mod_foo.slo
$ _

Then you have to update the Apache configuration by making sure a LoadModule directive is present to load this shared object. To simplify this step apxs provides an automatic way to install the shared object in its "modules" directory and updating the httpd.conf file accordingly. This can be achieved by running:

$ apxs -i -a mod_foo.la
/path/to/instdso.sh mod_foo.la /path/to/apache/modules
/path/to/libtool --mode=install cp mod_foo.la /path/to/apache/modules ... chmod 755 /path/to/apache/modules/mod_foo.so
[activating module `foo' in /path/to/apache/conf/httpd.conf]
$ _

This way a line named

LoadModule foo_module modules/mod_foo.so

is added to the configuration file if still not present. If you want to have this disabled per default use the -A option, i.e.

$ apxs -i -A mod_foo.c

For a quick test of the apxs mechanism you can create a sample Apache module template plus a corresponding Makefile via:

$ apxs -g -n foo
Creating [DIR] foo
Creating [FILE] foo/Makefile
Creating [FILE] foo/modules.mk
Creating [FILE] foo/mod_foo.c
Creating [FILE] foo/.deps
$ _

Then you can immediately compile this sample module into a shared object and load it into the Apache server:

$ cd foo
$ make all reload
apxs -c mod_foo.c
/path/to/libtool --mode=compile gcc ... -c mod_foo.c
/path/to/libtool --mode=link gcc ... -o mod_foo.la mod_foo.slo
apxs -i -a -n "foo" mod_foo.la
/path/to/instdso.sh mod_foo.la /path/to/apache/modules
/path/to/libtool --mode=install cp mod_foo.la /path/to/apache/modules ... chmod 755 /path/to/apache/modules/mod_foo.so
[activating module `foo' in /path/to/apache/conf/httpd.conf]
apachectl restart
/path/to/apache/sbin/apachectl restart: httpd not running, trying to start
[Tue Mar 31 11:27:55 1998] [debug] mod_so.c(303): loaded module foo_module
/path/to/apache/sbin/apachectl restart: httpd started
$ _

Fix error start apache :Cannot load /usr/local/apache2/modules/libphp5.so into server: /usr/local/apache2/modules/libphp5.so: cannot restore segment p

Error:

httpd: Syntax error on line 53 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/libphp5.so into server: /usr/local/apache2/modules/libphp5.so: cannot restore segment prot after reloc: Permission denied

Fix:chcon -t texrel_shlib_t /usr/local/apache2/modules/libphp5.so

Thursday, June 4, 2009

Compile Apache (with SSL), PHP 5 and MySQL on Linux

This article comes with a full reference on how to compile from source latest Apache 2.0.53 server, including support for SSL, PHP 5.0.3 as a module, and MySQL 4.1.10 database on a Linux. It was fully tested under SUSE Linux 9.1, SUSE Linux 9.2 and Fedora Core 3, but shall work with any Linux distribution (only on Debian you will have to change RPMs for proper deb packages).

Today, when almost every Linux distribution comes with a binary form of Apache 2.0.x, PHP 4.3.x and MySQL 4.0.x, it may seem a bit unnecessary to compile these, but, if you want some special configuration, latest components, or simply tune performance of your Apache, PHP and MySQL, compilation from source is the only possibility.

Basic system description:

PHP 5.0.3 will be compiled with support for: bz2, cpdflib, ctype, curllib, dom, ftp, gd2, freetype2, gettext, libiconv, libxml, mbstring, mysql, openssl, pcre, posix, session, SimpleXML, SPL, SQLite, tokenizer, xml, and zlib.

Apache 2.0.53 will be compiled with support for mod_access, mod_auth, mod_auth_digest, mod_deflate, mod_env, mod_headers, mod_setenvif, mod_ssl, mod_mime, mod_imap, mod_alias and mod_rewrite.

Compilation options:

Compilation can be customized by passing several parameters to gcc at runtime, for my Pentium-IV/HT/3.2GHz, this is a good starting set of parameters:

export CFLAGS="-march=pentium4 -mfpmath=sse -msse2 -O2 -pipe -s -fomit-frame-pointer"

You may get a list of gcc compilation options for your CPU at gcc.gnu.org.

All these scripts were fully tested under SESE Linux 9.1 with custom-built kernel 2.6.8.1 and Fedora Core 3 with custom-built kernel 2.6.9.1, and gcc version 3.3.3 / 3.4.2, but they shall work with any Linux distro (only on Debian you may need to change rpm packages for deb ones).

This manual assumes that all source files are located (downloaded to) /usr/local/src directory, SSL keys are placed into /home/ssl directory, and web root is located at /home/www directory.

Compile from source (Open) SSL:

Compilation of OpenSSL:

su
cd /usr/local/src
tar -zxvf openssl-0.9.7e.tar.gz
cd openssl-0.9.7e
./config --prefix=/usr/local
make
make install

Create a private key and place it into directory /home/ssl:

mkdir /home/ssl
cd /home/ssl
/usr/local/bin/openssl genrsa -des3 -rand \
some_big_file_1:some_big_file_2 \
-out localhost.key 1024

Next, we will create a private key without a pass-phrase, this is less secure, but it allows us to bootup the server without manually entering the pass-phrase every time…

/usr/local/bin/openssl rsa \
-in localhost.key \
-out localhost.key.unsecure

We will also create a request file that will be emailed to proper certification authority for getting a trusted SSL certificate (if needed) under file localhost.key.csr:

/usr/local/bin/openssl req -new \
-key localhost.key \
-out localhost.key.csr

While waiting for the certification authority, we can create a temporary self-signed certificate, good for 30 days:

/usr/local/bin/openssl x509 -req \
-days 30 \
-in localhost.key.csr \
-signkey localhost.key \
-out localhost.cert
chmod 400 localhost.cert
chmod 400 localhost.key
chmod 400 localhost.key.unsecure

Compile MySQL 4.1.10 database from source:

MySQL 4.1.10 has a completely different communication protocol and associated PHP mysqli functions. If your scripts were not designed for MySQL 4.1, you shall rather get MySQL release 4.0.23, to stay 100% compatible! Compilation options for MYSQL 4.0.23 will be the same, just remove one line with mysqli from PHP ./configure script.

However for any new development, MySQL 4.1.10 is recommended.

Compiling MySQL from source, and creating user / group called mysql:

cd /usr/local/src
tar -zxvf mysql-4.1.10.tar.gz
cd mysql-4.1.10
./configure \
--prefix=/usr/local/mysql \
--with-unix-sock-path=/tmp/mysql.sock \
--with-charset=utf8
make
make install
groupadd mysql
useradd -g mysql mysql
cp support-files/my-medium.cnf /etc/my.cnf
cd /usr/local/mysql
bin/mysql_install_db --user=mysql
chown -R root .
chown -R mysql var
chgrp -R mysql .

MySQL configuration file /etc/my.cnf can (for our local testing) look like this:

[client]
port = 3306
socket = /tmp/mysql.sock
[mysqld]
port = 3306
socket = /tmp/mysql.sock
skip-locking
key_buffer = 16K
max_allowed_packet = 1M
table_cache = 4
sort_buffer_size = 64K
net_buffer_length = 2K
thread_stack = 64K
skip-networking
server-id = 1
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
[isamchk]
key_buffer = 8M
sort_buffer_size = 8M
[myisamchk]
key_buffer = 8M
sort_buffer_size = 8M
[mysqlhotcopy]
interactive-timeout

Compile from source Apache 2.0.53 web server:

Quite a few web-hosting companies still use Apache 1.3.x, but time of Apache 2.0 incompatibilities and problems is long gone, so 2.0 is a better choice now.

And compile it:

cd /usr/local/src
tar -zxvf httpd-2.0.53.tar.gz
cd httpd-2.0.53
./configure \
--prefix=/usr/local/apache2 \
--enable-so \
--enable-auth-digest \
--enable-rewrite \
--enable-setenvif \
--enable-mime \
--enable-deflate \
--enable-ssl \
--with-ssl=/usr/local \
--enable-headers
make
make install

Next we have to modify (alter) main Apache config file located at /usr/local/apache2/conf/httpd.conf (this also assumes your web root is located at /home/www):

DocumentRoot "/home/www"

And we well add support for PHP 5 (as a module):

LoadModule php5_module modules/libphp5.so
DirectoryIndex index.html index.htm index.php
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

We also have to allow / create basic mod_rewrite rules:


Options Indexes Includes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all

And dissalow clients to access .htaccess:


Order allow,deny
Deny from all

Next, if using SSL (on standard port 443), we will have to modify file /usr/local/apache2/conf/ssl.conf as follows (just replace the file content with this):

Listen 443

ServerName localhost
SSLEngine on
SSLCertificateFile /home/ssl/localhost.cert
SSLCertificateKeyFile /home/ssl/localhost.key.unsecure

Compile from source PHP 5.0.3:

For compiling PHP, we will need quite a few external libraries, like libcurl, libiconv, libjpeg, libpng, and few others, which we have to download and compile first:

Compile libiconv from source:

cd /usr/local/src
tar -zxvf libiconv-1.9.2.tar.gz
cd libiconv-1.9.2
./configure --prefix=/usr/local
make
make install

Compile libjpeg from source:

cd /usr/local/src
tar -zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b
./configure --prefix=/usr/local
make
make install
make install-lib

Compile libpng from source:

cd /usr/local/src
tar -zxvf libpng-1.2.8.tar.gz
cd libpng-1.2.8
cp scripts/makefile.linux makefile
make
make install

Compile cpdflib from source:

cd /usr/local/src
tar -zxvf clibpdf202r1.tar.gz
cd ClibPDF/source
cp Makefile.Linux makefile
make
make install

Compile curl from source:

cd /usr/local/src
tar -zxvf curl-7.12.1.tar.gz
cd curl-7.12.1
./configure --prefix=/usr/local
make
make install

Compile freetype 2 from source:

cd /usr/local/src
tar -jxvf freetype-2.1.9.tar.bz2
cd freetype-2.1.9
./configure --prefix=/usr/local
make
make install

Next, we will compile PHP, with support for MySQL, iconv, curl, zlib, gd2, mbstring, SSL and many other modules:

cd /usr/local/src
tar -jxvf php-5.0.3.tar.bz2
cd php-5.0.3
./configure \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-mysql=/usr/local/mysql \
--with-mysqli=/usr/local/mysql/bin/mysql_config \
--with-mysql-sock=/tmp/mysql.sock \
--with-sqlite \
--enable-sqlite-utf8 \
--with-zlib \
--with-zlib-dir \
--with-bz2 \
--with-gd \
--enable-gd \
--enable-gd-native-ttf \
--with-jpeg-dir=/usr/local \
--with-png-dir=/usr/local \
--with-ttf \
--with-freetype-dir=/usr/local \
--with-iconv=/usr/local \
--with-curl=/usr/local \
--enable-track-vars \
--with-gettext \
--with-config-file-path=/usr/local/apache2/conf \
--enable-trans-id \
--enable-ftp \
--with-cpdflib=/usr/local \
--enable-mbstring \
--with-openssl=/usr/local
make
make install
cp php.ini-dist /usr/local/apache2/conf/php.ini

Next, we have to modify PHP configuration in file /usr/local/apache2/conf/php.ini, including basic PHP security settings:

mysql.default_socket = /tmp/mysql.sock
short_open_tag = Off
register_globals = Off
allow_url_fopen = Off

How to start Apache and MySQL at bootup?

The last thing left is to create a startup script, whitch will allow to run Apache and MySQL at bootup, automatically, so that we don’t have to do it manually. We will create a new file (for SuSE Linux 9.1, other ditros may vary here) /etc/init.d/web and set “executable” flag to it.

#! /bin/sh
#
# /etc/init.d/web
#
# (c) Radek HULAN
# http://hulan.info/
#
### BEGIN INIT INFO
# Provides: apache-mysql
# Default-Start: 5
# Default-Stop: 5
# Description: Starts Apache2 and MySQL 4
### END INIT INFO

case "$1" in
start)
/usr/local/apache2/bin/apachectl start
/usr/local/mysql/share/mysql/mysql.server start
;;
stop)
/usr/local/apache2/bin/apachectl stop
/usr/local/mysql/share/mysql/mysql.server stop
;;
restart)
/usr/local/apache2/bin/apachectl restart
/usr/local/mysql/share/mysql/mysql.server restart
;;
esac

Next we will run YaST, section “System”, sub-section “Run level editor”, where we will enable service web for runlevel 3 and 5.

Testing the system?

First, start Apache and MySQL servers by entering:

/etc/init.d/web start

Next, create file /home/www/index.php with the following content:

     

In your browser, type URL http://localhost/ and https://localhost/, and if everything is installed fine, you will see a lot of information about your new Apache/PHP/MySQL installation.

phpMyAdmin:

We will also need phpMyAdmin to manage MySQL database, by entering http://localhost/db/ into our browser:

Installation of phpMyAdmin into /home/www/db:

mkdir /home/www
cd /home/www
tar -jxvf /usr/local/src/phpMyAdmin-2.6.1.tar.bz2
ln -s phpMyAdmin-2.6.1 db

Next, we will configure phpMyAdmin’s advanced feaures, by modifying file /home/www/db/config.inc.php:

// URL to phpMyAdmin
$cfg['PmaAbsoluteUri'] = 'http://localhost/db/';

//connection settings
$cfg['Servers'][$i]['connect_type'] = 'socket';
$cfg['Servers'][$i]['extension'] = 'mysqli';

// user na password
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = '';

// PMA settings
$cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
$cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark';
$cfg['Servers'][$i]['relation'] = 'pma_relation';
$cfg['Servers'][$i]['table_info'] = 'pma_table_info';
$cfg['Servers'][$i]['table_coords'] = 'pma_table_coords';
$cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages';
$cfg['Servers'][$i]['column_info'] = 'pma_column_info';
$cfg['Servers'][$i]['history'] = 'pma_history';
$cfg['Servers'][$i]['verbose_check'] = FALSE;

// persistent connections
$cfg['PersistentConnections'] = TRUE;

// do not display logo on the left
$cfg['LeftDisplayLogo'] = FALSE;

// show MySQL and PHP info
$cfg['ShowMysqlInfo'] = TRUE;
$cfg['ShowMysqlVars'] = TRUE;
$cfg['ShowPhpInfo'] = TRUE;

// show BLOBs
$cfg['ShowBlob'] = TRUE;

After everything is installed, use phpMyAdmin SQL window to run script /home/www/db/scripts/create_tables_mysql_4_1_2+.sql to create PMA tables, needed by phpMyAdmin.

Debugging PHP:

There are several tools, like PHPeclipse, which allow to debug PHP, in a full-featured IDE. In order to use PHPeclipse, you need to install PHP debugger first.

Installation:

cd /usr/local/src
tar -zxvf dbg-2.11.32-src.tar.gz
cd dbg-2.11.32
./deferphpize
mkdir /usr/local/modules
cp modules/dbg.so /usr/local/modules
cp modules/dbg.la /usr/local/modules

Next, you will have to modify PHP configuration file located at /usr/local/apache2/conf/php.ini, add here:

; load debugger
extension_dir = "/usr/local/modules"
extension=dbg.so

; debugger configuration
[debugger]
debugger.enabled = true
debugger.profiler_enabled = true
debugger.JIT_host = localhost
debugger.JIT_port = 10001
debugger.JIT_enabled = on

; implicint flush - use only when debugging
implicit_flush = On

Do you need mod_perl as well?

Installation and compilation:

cd /usr/local/src
tar zxvf mod_perl-2.0-current.tar.gz
cd mod_perl-1.99_16
perl Makefile.PL MP_APXS=/usr/local/apache2/bin/apxs
make
make install

Next, you have to modify Apache configuration file located at /usr/local/apache2/conf/httpd.conf to load mod_perl, and set to use perl at directory /home/www/perl:

LoadModule perl_module modules/mod_perl.so
PerlModule Apache2
Alias /perl/ /home/www/perl/

SetHandler perl-script
PerlResponseHandler ModPerl::Registry
PerlOptions +ParseHeaders
Options +ExecCGI

Testing? Create file /home/www/perl/test.pl, issue chmod 755 test.pl on it, and type http://localhost/perl/test.pl in your browser to test your mod_perl installation.

#!/usr/bin/perl
print "Content-type: text/plain\n\n";
print "mod_perl 2.0 rocks!\n";