Installing under Linux - Page 5
January 3, 2002
This section covers the procedure for installing PHP and MySQL under most current distributions of Linux. These instructions were tested under the latest versions of RedHat Linux and Mandrake Linux; however, they should work on other distributions such as Debian without much trouble. The steps involved will be very similar, if not identical.
As a user of one of the handful of Linux distributions available, you may be tempted to download and install the RPM distributions of PHP and MySQL. RPM's are nice, pre-packaged versions of software that are really easy to install. Unfortunately, they also limit the software configuration options available to you. If you already have MySQL and PHP installed in RPM form, then feel free to proceed with those versions, and skip forward to the "Post-Installation Setup Tasks" section. If you encounter any problems, you can always return here to uninstall the RPM versions and reinstall PHP and MySQL by hand.
Since many Linux distributions will automatically install PHP and MySQL for you, your first step should be to remove any old RPM versions of PHP and MySQL from your system. If one exists, use your distribution's graphical software manager to remove all packages with 'php' or 'mysql' in their names ('mod_php' is one that is often missed).
If your distribution doesn't have a graphical software manager, or if you didn't install a graphical user interface for your server, you can remove these from the command line. You'll need to be logged in as the root user to issue the commands to do this. Note that in the following commands, "%" represents the shell prompt, and doesn't to be typed in.
If any of these commands tell you that the package in question is
not installed, don't worry about it unless you know for a fact
that it is. In such cases, it will be necessary for you to remove
the offending item by hand. Seek help from an experienced user if
you don't know how. If the second command runs successfully (i.e.
no message is displayed), then you did indeed have an RPM version
of PHP installed, and you'll need to do one more thing to get rid
of it entirely. Open your Apache configuration file (usually
These lines are responsible for telling Apache to load PHP as a plug-in module. Since you just uninstalled that module, you'll need to get rid of these lines to make sure Apache keeps working properly. You can comment out these lines by adding a hash (#) at the beginning of both lines.
To make sure Apache is still in working order, you should now restart it without the PHP plug-in:
With everything neat and tidy, you're ready to download and install MySQL and PHP.