Impossible tri-bar

Digital Phenomena - Your first stop for internet consultancy 
PHP4 Installation Overview

Page 3 — Installing Apache (Non-Windows)

This section tells you how to do a fresh install of Apache on your system. This will ensure that the PHP DSO will actually work when it's dumped in there. The necessary preparations include enabling mod_so in Apache, which allows Apache to use DSOs.

If you already have a version of Apache installed, you can check to see if you have mod_so enabled. If you do, you can skip through this section. To check for mod_so, do the following:

  1. cd to the Apache bin directory (/usr/local/apache_[version]/bin/ or wherever you installed Apache originally)
  2. Type ./httpd -l

You should see a list of enabled modules, and if "mod_so.c" shows up in that list, you can skip ahead to the PHP installation section. If "mod_so.c" doesn't show up in your list, you can skip ahead to step 6 in the list below, to enable mod_so in Apache.

But if mod_so isn't enabled, then it's time to install Apache from scratch, which is easy -- just follow these simple steps:

  1. Go to http://www.apache.org/dist/ and grab the latest version of the source code.
  2. Put this file somewhere logical, like /usr/local/ or /opt/ or anywhere else you want.
  3. Unzip or uncompress the file, so that you're left with the *.tar file.
  4. Type the following to un-tar the file into a directory called apache_[version]:
    tar -xvf apache_[version].tar
    
  5. cd into /usr/local/apache_[version] (or wherever you un-tared it)
  6. Type the following to prepare for building, replacing [path] with your own path, such as /usr/local/apache[version] (no trailing slash!)
    ./configure --prefix=[path] --enable-module=so
    

At this point in the sequence the configuration script will check for a few things, then build the makefiles. When the configuration process is complete, your shell prompt will return. Hopefully, you had no fatal errors or other bad warnings. If you encounter warnings or errors, try to decipher the problem from the messages that appear and try the configuration again. You can also visit Apache.org and read through their FAQs and documentation.

If you had no errors, you're ready to move on to the build process. Just type the following at the prompt:

make

The makefile runs through its paces, compiling Apache. Again, the goal is to get through this step without warnings and fatal errors. When you're back at the prompt, type:

make install

At this point, the compilation will create the final set of directories and files and return a lovely message from the Apache Group, thanking you for installing Apache on your system.

During the installation process, a default set of configuration files was placed in the "conf" directory, under the installation directory (i.e., "/usr/local/apache_[version]/conf/" or some such). If you make a few minor changes to the httpd.conf file (the master Apache configuration file), you can start Apache and make sure that it's working properly.

  1. In your text editor of choice, open httpd.conf and find a line starting with ServerAdmin.
  2. Change the default entry to real values, such as:
    ServerAdmin joe@schmo.com
    
  3. Find a line starting with ServerName.
  4. Change the default entry to real values, such as:
    ServerName localhost
    

    If you have a real machine name, like mybox.yourdomain.com, go ahead and use it instead of localhost:

    ServerName mybox.yourdomain.com
    
  5. Save the file.
  6. cd up a directory (type cd ..)
  7. Start Apache using the following command:
    ./bin/apachectl start
    

This command will start Apache (hopefully). You should see a message like "httpd started." Follow that up by opening your Web browser and type "http://localhost/" in the location bar (if you used a ServerName other than localhost, type that in the location bar instead). Again -- and I can't stress this enough -- if your installation fails at any point, visit the Apache website and read the FAQ and documentation.

If everything is hunky-dory, move on to the next section to compile PHP.

next page»


|Home|About Us|Services|Search|
|Software|Products|Support|Links|Latest|
W3C validatedW3C validated CSSCompatible with all browsers