Installing on a Linux Server

I l @ ve RuBoard

The popularity of Linux as an operating system, especially for use as a Web server, over the past couple of years has risen dramatically. The fact that it is free and very stable is a huge mark in its favor. However, the difficulty in setting up a Linux machine can still be a hurdle to overcome , although this is less of a problem now than it used to be.

In order to be able to do any installation on a Linux server, you must have the root password and access. The server does not necessarily need to be online though: you can work entirely on the one machine or create a mini-network by connecting another computer to it and "dialing-in."

To install Apache and PHP:

  1. Download the most current, stable versions of Apache and PHP to a common directory, such as /usr/local/ (Figure A.1).

    Figure A.1. The ls command lists all the files within the current directory. PHP and Apache are in this folder along with a number of other libraries and applications.

    graphics/afig01.gif

    The Apache files can be found at http://www.Apache.org.

  2. If the files have the .gz extension, use these lines to unzip each (press Return after typing each individual line):

     gunzip php-4.0.4pl1.tar.gz gunzip apache_1.3.14.tar.gz 

    Although I will be referring to the specific versions of PHP and Apache that I installed for this demonstration, be sure to refer to the version you are using when you do your installation (e.g. , php-3.0.3pl1 ).

  3. Unpack the files:

     tar xvf php-4.0.4pl1 tar tar xvf apache_1.3.14.tar 

    In order to get to the raw files, you'll need to run those two lines. This will change each package from one compressed version to a folder containing all of the specific files. You'll see a lot of information on the screen after typing each line (Figure A.2).

    Figure A.2. When you use tar to expand a package, you'll see all the files it contains listed.

    graphics/afig02.gif

  4. Move to the newly created Apache folder, then run the configuration (Figure A.3).

    Figure A.3. After configuring, making, and installing Apache, it will show you this message demonstrating that everything worked properly.

    graphics/afig03.gif

     cd ../apache_1.3.14   /configure prefix=/www 

    The cd command allows you to change folders. Once you are within the Apache folder, you can preconfigure it.

  5. Move to the PHP folder (Figure A.4) and run its configuration.

    Figure A.4. All the unpacked files and folders are now located within the PHP folder.

    graphics/afig04.gif

     cd ../php-4.0.4pl1  ./configure with-apache=../  apache_1.3.14 enable-track-vars 

    What configuration parameters you use depends upon which features you want PHP to support. Each configuration command of the sort with requires you to indicate the directory where that particular item can be found. In this example, I want PHP to work with Apache and I state where the Apache folder is. The enable-track-vars option is necessary for PHP to properly use HTML forms.

  6. Make and install the PHP (Figure A.5).

    Figure A.5. Successful configuration, making, and installing of PHP will finish with the license and a thank you.

    graphics/afig05.gif

     make make install 

    These two lines of code install the configured PHP so that it is usable by Apache.

  7. Move back to the Apache folder, run its configuration, then make and install it.

     cd ../apache_1.3.14 ./configure activate-module=  rc/modules/php4/libphp4.a make make install 

    Now that you have configured, made, and installed Apache, it is ready to run.

  8. Copy the php.ini file to its new location.

     cp /usr/local/php-4.0.4pl1/  php.ini-dist /usr/local/lib/php.ini 

    The php.ini file dictates how PHP operates. It comes with the package as php.ini-dist. In order for Apache to make use of it, it must be copied to the proper directory and renamed .

  9. Start Apache.

     bin/apachect1 start 

    Like any application, Apache must be running in order to work. If you are within the Apache folder, this line will start up the Web server.

  10. Test to see if Apache and PHP is working by going to the proper URL with your Web browser (Figure A.6).

    Figure A.6. Apache uses this default page to indicate that it is running properly.

    graphics/afig06.gif

    If the server is online, you can go to the URL such as http://www.DMCinsights.com. If the machine is not online, use either http://localhost/ or an IP address assigned to the machine.

Tip

You can test the PHP installation by using the test.php file created in Chapter 1, Introduction.


Tip

Because Linux can run on machines with very outdated hardware (I have one Linux machine with 16MB of RAM, a 1 GB hard drive, and a 90Mhz processor!), creating a Web server from an old Windows machine is a perfectly reasonable thing to do and is an excellent way to learn.


I l @ ve RuBoard


PHP for the World Wide Web (Visual QuickStart Guide)
PHP for the World Wide Web (Visual QuickStart Guide)
ISBN: 0201727870
EAN: 2147483647
Year: 2001
Pages: 116
Authors: Larry Ullman

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net