Michel Verdier
Create Your Badge
|
Apache/Front Page/PHP/MySQL/OpenSSL Server on Slackware Linux
Apache/PHP/MySQL/Front Page/OpenSSL
Server on Slackware Linux
Updated Sunday August 01, 2010 7:13:32 PM

This document is about building a multipurpose webserver that will support
dynamic web content via the PHP scripting language, integrated with support for
the MySQL database, secure transmission of data based on Open SSL, and M$
Frontpage Server Extensions.
This document is not derived from the official Mini-HOWTO written by
Marcus Faure, marcus@faure.de, which can be
found as Linux
Apache SSL PHP/FI frontpage mini-HOWTO This document serves as an
instruction set for those not interested in the pre-rolled subsets of Apache-PHP,
Apache-SSL, or Apache-FP you can find easily from any major rpm-type Linux
distributor (i.e.: Red Hat, Caldera Open Linux, Turbo-Linux).
The instructions here, will be most useful to those running BSD-style
Linux/UNIX servers who have access to a good GNU compiler and the
Internet.

Introduction
I began publishing Internet content at Van's Home on the servers
at Alliance Network
running on an apache-1.something-or-other.x in 1995. The only thing I
could do on that box of any dynamic nature was run some cron jobs under my shell
account that would grep the access_log for hits to my site and write it to an
html file somewhere in my public_html directory. Times have
certainly changed, and, designing dynamic web-content became a whole lot easier
when Rasmus Lerdorf came out with PHP-FI
in 1995 at Apache version 1.0.x. It evolved from a hit counter Rasmus
wrote to determine the amount of activity being generated from his on-line
resumé, and, as others learned of it and asked for more features, evolved into
Personal Home Page Tools, which later became Personal Home Page Construction
Kit, PHP-FI, PHP3, and, now PHP4. I'll go into what each of these
things above are, what they do for you, and, why you might want them shortly,
but, basically, this HOWTO was originally written because putting all the things
together correctly to get the server configured as the title implies was not
easy. It's become easier since 1998, when I was running PHP-FI-2.0, but,
the level of activity to this page seems to indicate it's still not a walk
in the park. The ultimate goal of this exercise is to have a
Linux/UNIX server configured with the Apache Web server, integrated with PHP and
having support for MySQL, has https encryption support via OpenSSL, and, allows
web developers for applications running on it to use Visual InterDev Studio, or
FrontPage98/2000 for Windows to develop those applications. Now a little
on what each of these are. Apache
The web server that runs
60% of the Internet was developed from the NCSA httpd server with it's first
official public release (0.6.2) of the Apache
server in April 1995. The name comes from A PAtCHy, which indicates it's
basically a patched-together server and implies how extensible it is. It's
open source code allows for third parties to add virtually anything they wish to
the existing web server functionality it already offers. You
probably wouldn't be reading this document if you didn't have a need and/or
interest in running a web server on your intranet, or on the Internet for some
reason. The motivation to run Apache over other types of web servers is
probably cost: it is free, as in beer. It costs you absolutely
nothing to download, install and make money from services provided by the Apache
server. There are other alternatives, however, discussing them is beyond
the scope of this document. What the Apache server can do for you is
enable your Linux/UNIX machine to serve web content to browser-based
applications for one, or many Internet domains, and gives you the flexibility to
put it together in a way in any specialized way you deem fit for your web
application needs. Out of the box, the Apache server is fine for
delivering static content. The purpose of this document would imply that
you're looking for more dynamic web-serving facilities. PHP4
PHP (Professional Home Page) scripting language enables easily
coded dynamic applications to be created with the Apache server. There are
more and more PHP applications being developed every day. It's an
alternative to writing CGI or Perl to get your web pages to do dynamic
things. It's currently
in use by 37.82% of those sites running Apache. To be fair, there is
another option for writing dynamic web applications, and these options are
provided with the Microsoft IIS4/5 Internet Server running ASP (Active Server
Pages). But, as PHP's popularity continues to increase, and the OSS (Open
Source Software) applications continue to be contributed back to the community,
and, developer's continue to build their PHP coding skills, we can expect PHP to
be at the fore-front of dynamic web-based application toolkits for several years
to come. PHP has evolved a great deal since it's
initial inception, and, has undergone 3 full code rewrites. This HOWTO,
began with PHP-3.0.6 and has kept current within the PHP-3.0.x tree, and, has
not evolved to PHP4 for a reason. Specifically, it was due to lack of
gd1.3 support. GD is
the gif development library created by Thomas Boutell and discontinued
gif support at version 1.6. Also, gd1.3 is no longer available anywhere on
the Internet, due to licensing changes. Some of the applications on DedSerius.com
require the GD support, and, I still use it. I've attempted to do similar
things with the built in GD-1.8 support for PHP that provides png and jpeg
support, but, have not found it's performance to be adequate for a production
server with the types of image-creation applications deployed here. If you
don't need such applications, go with the native gd support for PHP.
Otherwise, you can e-mail me, and, I'll
send you a copy of gd1.3. I've been able to get PHP4 to
compile with gd1.3 on both FreeBSD and Linux, so, this HOWTO now incorporates
that change. The performance and feature advantages in running PHP4 over
PHP3 are definitely worth it, so, unless you have some compelling reason to stay
with PHP3, I highly recommend the more current version. MySQL
Monty
Widenius extended msql and created the first release in 1995 as MySQL-????.
Steps Follow
these links in the order they should be installed...
Step
Version
N/A
3.23.22-beta
FrontPage 2000 Server Extensions for Unix, Version 4

OpenSSL Steps
(Optional) {coming soon}
 | OpenSSL - (Optional) |
openssl-0.9.5a
 | Apache Shared Memory Library -(Optional) |
mm-1.1.3
 | ModSSL - (Optional) |
mod_ssl-2.6.5-1.3.12

gd1.3
php-3.0.14
Apache-1.3.12
Background:
While not the "Official" how-to, this site has taken significant
enough traffic over the past year, that I felt it only fair to make it
current. I put this site together because I was running Front-Page 98
extensions on a Red Hat box for a client I was doing y2k work for. I'm not
very fond of Red Hat as a server, although it does have it's merits. My
preference is Slack, and, I seem to be in good company
While it was fairly trivial to get the patches applied on a Red Hat box,
that's to be expected. If you're running Red Hat and don't want to put
anything special in your web-server, you can simply get the apache-fp-patched
server from Ready To Run Software, or Microsoft, and, be done with it. If
you want to read the archived version of this How-To, it's
right here. Again, if you don't need SSL support, you'll save quite a
bit of time, if you follow the instructions right
here.
But, I realize your time is limited, and, you'd like to get down to the
(./configure && make && make install)s, so, here you are.
(Note: All links open up a new window. I find it more useful to have
several windows open than to have to re-navigate to lost links. If you
want to close one, it's trivial to do so.)

Back UP!!!:
Before even starting this process ensure you get a good back
up of your existing DocumentRoot, and configuration files for your Apache
Server
| Steps |
Command(s) |
Notes |
| Back up Configuration Files |
tar czvf /backup- destination/apache.conf.tgz
/usr/local/apache/conf |
Typically, this will be in one of the following directories:
 | /usr/local/apache/conf |
 | /var/lib/apache/conf |
Replace /backup-destination with the path of the directory to
which you're tarring your configuration files.
The important files are httpd.conf, srm.conf and access.conf
|
| Back up Web Files |
tar czvf /backup- destination/apache.docs.tgz
/usr/local/apache/htdocs |
Typically, this will be in one of the following
directories:
 | /usr/local/apache/htdocs |
 | /var/lib/htdocs |
or any number of other places depending on your
UNIX/Linux distribution.
Replace /backup-destination with the path of the directory to
which you're tarring your web content
Also, if you're using per-user webs, you might want to back up
/home (or, whereever your user directories are). |

Install MySQL:
| Steps |
Command(s) |
Notes |
| Install Base MySQL |
cd /usr/src
tar xzvf mysql-3.23.22-beta.tar.gz
cd mysql-3.23.22-beta
./configure -with-mysqld-user=mysql -localstatedir=/mysql
make
make install
|
By default, MySQL will install it's databases to /usr/local/var.
If you're Serius about running database servers, you should put the
database on it's own partition. I'm giving you advice, here, but, it's
possible someone might disagree. Either way, my databases are on their own
partition and by convention named /mysql
 | /mysql |
With respect to the user, you can run the user as anything you
want. I use mysql and create a UNIX user named mysql. I also create
a UNIX group named mysql and have mysql be the default group for user
mysql.
It's only relevant when you get into UNIX permissions problems
with the MySQL user. By default /mysql will have root.root permissions,
and the mysql daemon won't start because it doesn't have permissions to do so.
This is trivial. If you agree with the above philosophy,
simply groupadd mysql; adduser mysql in default group mysql and then do the
following:
chown mysql.mysql /mysql
chmod 0750 /mysql -Rf
This will ensure that no user can access the mysql databases,
unless you add them to the mysql group.
It's your choice, either way.
|
| Start/(Stop?) the mysql database
server |
If you already have
the server installed:
mysqladmin -p
shutdown mysqladmin -p start
Otherwise, you'll need to create the
default tables:
/usr/local/bin/mysql_install_db
/usr/local/bin/safe_mysqld |
You'll
also need to set up the start-up scripts on your respective system.
Typically, they're found in /etc/rc.d, or /etc/init.d depending on whether
you run SysV, or BSD style Linux. Since you're here to learn about
Slackware Apache/FrontPage, I'll assume you're using BSD-style. My
script follows. Copy the following, tweak the parameters for your
hardware/configuration into a file in /etc/rc.d/ (I use rc.mysql)
and add a call to it in rc.M: #!/bin/sh ulimit -H -S -u 1024 1> /dev/null 2> /dev/null
# Up the file-handle limits
# Set hard/soft limit
ulimit -H -S -n 8192 1> /dev/null 2> /dev/null
/usr/local/libexec/mysqld --user=mysql -l/mysql/servername.log \
-O max_sort_length=64 \
-O key_buffer=96M -O table_cache=1024 \
-O sort_buffer=96M --skip-locking \
-O record_buffer=32M --data=/mysql > /dev/null & |
Install MySQL Perl Modules
 | data-dumper |
 | data-showtable |
 | dbi |
 | Msql-Mysql |
|
Data
Dumper:
cd /usr/src tar xzvf /pathto/data-dumper-2_101_tar.gz cd
Data-Dumper-2.101 perl Makefile.PL
make make test
make install
Data ShowTable:
cd /usr/src tar xzvf
data-showtable-3_3_tar.gz cd Data-ShowTable-3.3
perl Makefile.PL make make test make install
Data DBI:
cd /usr/src tar xzvf dbi-1_13_tar.gz cd
DBI-1.13 perl Makefile.PL make
make test
make install Data
Msql-Mysql:
cd /usr/src tar xzvf
msql-mysql-modules-1_2214_tar.gz cd Msql-Mysql-modules-1.2214 perl Makefile.PL
-static touch README make make install |
Most of the modules (All?) are installed on a stock Slackware 7.x distribution,
so, you shouldn't need to do this. But, if you're anal and want the
freshest stuff, be my guest.
The
most current versions of these modules can be downloaded from the MySQL
contributors site.
When you Compile DBI, //(proxy will get skipped).
Current Versions:
 | Data Dumper = 2.101 |
 | Data ShowTable = 3.3 |
 | DBI = 1.13 |
 | Msql-Mysql = 1.2214 |
As Of: 2000-09-12 23:09:21 |

Install FrontPage 2000 Server Extensions:
| Steps |
Command(s) |
Notes |
| Install Apache 1.3.12 |
cd /usr/src tar xzvf /path to Apache/apache_1.3.12.tar.gz
cd apache_1.3.12 ./configure --enable-module=expires \ --enable-module=headers \ --enable-module=log_agent \ --enable-module=log_referer \ --enable-module=usertrack
make
make install
* Don't do this if you're server is
publicly accessible until you've made it not publicly accessible!!!
/usr/local/apache/bin/apachectl stop
/usr/local/apache/bin/apachectl start
|
Pull your server off the wire, at this point! The Apache
you're about to compile and start will not have parsing for PHP3 embedded.
Your scripts will be visible. You might be able to get away with not
following this warning if your web server is running and you haven't issued the
apachectl stop/start command. Just pray the power doesn't recycle on your
server. You've been Warned!
If you do restart the server, it won't if you've enabled php3_asp_tags
On. In this case, edit your httpd.conf to comment out that line.
It's your responsibility to know how to do this.
If vi /usr/local/apache/conf/httpd.conf, it's
/php3_asp_tags
i#
<ctrl>]
:w[RETURN]
Then, restart it, and work quickly. >:)
Keep in mind a "restart" signal to the apachectl
command will not restart the server if you're moving from version 1.3.x to
1.3.y. Again, you've been warned.
The deal here is that you need to have the Apache source
distribution in the /usr/src directory before you begin the Front Page
procedure(s).
The reason for this is that you need to have the source
distribution in a specific spot before you can patch the source with the apache-fp
patch.
In other words: You can put Front Page Apache on your
server with the step below, but, you can't have the PHP/MySQL/SSL, etc. built
into it.
If you don't do this step, then, when you add the other
modules and build Apache with the FrontPage Extensions, you'll have your
permissions so mucked up, it'll take you days to get the front-page extensions
to work within your apache server, even if it was compiled correctly.
Additionally, the FrontPage installation is going to ask you
where your httpd.conf file is located. Once you complete this step, it
will live in /usr/local/apache/conf/httpd.conf. If this isn't a new
server, apache will preserve your configuration, and, you'll have to tweak it a
little. If it's a brand new apache, you'll have to modify the httpd.conf
file, anyway.
I'm sure I just opened myself up to a slew of feedback, but,
simply stated: that's what happens. >:)
|
| Install Front Page 2000 Server
Extensions |
cd /usr/local tar xzvf /path to Front Page 2000/fp40.linux.tar.gz
cd frontpage ln -s
version4.0 currentversion
cd currentversion
Sorry: You have to stop the web-server,
now.
./change_server.sh
cd currentversion/bin
./fpsrvadm.exe -o install
(This one will take a while. I don't care
how fast your server is.)
|
If you have existing frontpage information in your DocumentRoot, you might run into problems with the install script. I can't
help you much here, but, it can happen if you have frontpage information below
the -m virtualweb you're installing. Here's what I do. Don't try it,
unless you understand what the following does:
find /var/www -name '*_vti*' -exec rm -Rf {} \;
After this step, I'd suggest trying to connect to the server
from a FrontPage client, or Visual Interdev. If it works, you're getting
close.
After the change_server.sh step, you'll be able to connect
through frontpage client. I'd suggest you do this, to ensure, your
permissions are getting close to where they need to be. Stay
Off the fp_install.sh script. This will open your server to arbitrary
administration! |

Install GD 1.3:
| Steps |
Command(s) |
Notes |
| Install GD 1.3 |
cd /usr/
tar xzvf /path to/gd1.3.tar.gz
cd gd1.3 make
cd ..
cp libgd* /lib
Add /usr/gd1.3 to your PATH statement with
export PATH=$PATH:/usr/gd1.3 {You'll probably want this line in your
/etc/profile}
ldconfig -v
|
Tom Boutelle, the maintainer of the library no longer supports
gif. The reason I run php-3.0.14 is due to the change away from his
gd1.3 library, which I need to support various image routines in my
applications. I've tried the jpeg libraries, but, was ultimately
disappointed by the performance penalty. I'm sticking with gd1.3, for
now. If you don't need image-parsing routines, you can skip this step.
If
you need a gzipped tarball of it, let me know, and, I'll give you a copy of
mine
. |

Install PHP:
| Steps |
Command(s) |
Notes |
| Compile PHP3 |
cd /usr/src
tar xzvf /path to/php-3.0.14.tar.gz
cd php-3.0.14
./configure --with-apache=/usr/src/apache_1.3.12
--with-mysql=/usr/local --with-gd=/usr/gd1.3
make
make install |
No major feat, here. If you want a different
version of PHP that doesn't require the gd1.3 library use that instead.
Hell, I've heard you can even use this procedure to install PHP4 with the
above...
See Wes for details. He's also got MSSQL
Support. Don't ask. >:)
|

Install Apache:
| Steps |
Command(s) |
Notes |
| Compile and Install
Apache |
cd /usr/src/apache_1.3.12
patch -p0 < /usr/local/frontpage/version4.0/apache-fp/fp-patch-apache_1.3.12
cp mod_frontpage.c src/modules/extra/
./configure --enable-module=expires \
--enable-module=headers \
--enable-module=log_agent \
--enable-module=log_referer \
--enable-module=usertrack \
--activate-module=src/modules/php3/libphp3.a \
--add-module=mod_frontpage.c
make
make install
/usr/local/apache/sbin/apachectl stop
/usr/local/apache/sbin/apachectl start
|
This part's pretty much a
no-brainer, and, you're about done, now.
The only caviat is to add the php3_asp_tags
On directive to your httpd.conf file. The benefit is that you
can use <% %> instead of <? ?> or <?php ?> for your
tags. This makes FrontPage Express, FrontPage 2000 and Visual Interdev
behave.
|
Let me know if this worked for you. -- van

|
77,764 hits since September 13, 2000.
Mail me, with your comments.
I updated this page on Sunday August 01, 2010 7:13:32 PM
Van
|
|