LD SoftwareBespoke Software, Web Design, Security Consultants and Host Services.


You have been warned!
We have caught 5846 shameful hackers.


Paypal Referral
Sign up for PayPal and start accepting credit card payments instantly.

Link Exchange
Join our free link exchange

Click Here
Apache, PHP and MySQL on Red Hat Linux

3.6.5. Apache, PHP and MySQL on Red Hat Linux

For some obscure reason, Red Hat 8.0 does not connect the PHP package to that of MySQL and we have to resort to some tricks to make them work together. Thus, for Red Hat, you have to proceed as follows:

If Apache, PHP and MySQL are not already installed, install the appropriate packages. For Red Hat 8.0, choose the "Packages" menu entry as shown in Figure 3-22.

Figure 3-22. Red Hat Menu: Packages.

Red Hat Menu: Packages.

Once you have entered the system (as root), you can choose the three necessary pieces (Apache, PHP and MySQL):

  • Apache is found under "Web Server".

  • PHP is found under "Web Server".

  • MySQL is found under "SQL database Server".

To see what is contained in each section, click on the "Details" link (Figure 3-23).

Figure 3-23. Red Hat: Package Sections.

Red Hat: Package Sections.

After the selection of packages, you must click on "Update" and Red Hat will go on to install them, after it has checked their dependencies.

Now, Apache, PHP and MySQL are installed, but unfortunately, we are not yet done: we must ensure that PHP will talk to MySQL. To this end, we must do 2 things:

  1. Edit the php.ini file, so that PHP supports also files that start with "<?" - and not only those that start with "<?php".

  2. Install the mysql.so file.

We recall that, in order to edit a system file, we must be root. We can nevertheless do our edits without logging out first, if we do the following:

  • Open a terminal window (System -> Terminal)

  • Login as root (command "su", then enter the password)

  • Start our preferred text editor (see Chapter 11). The editor will start with root privileges, so you can edit the php.ini file, usually located under /etc, and set the short_open_tag parameter to ON:

    ; Allow the <? tag. Otherwise, only <?php and <script> tags are recognized.
    short_open_tag = On
  • For your local experiments, it is comfortable to also set safe_mode to OFF and register_globals to ON (but see Section 23.4.2 for the security related point of view on this).

  • Save everything and you are done with operation 1 above.

  • Operation 2 is simple: just copy the mysql.so file brutally into /usr/lib/php4/. You should do this with root permissions.

The only thing that remains now, is to restart the services. We can do this from the command-line of a terminal window and also through a graphical tool. For the novice user, we will describe the graphical way - again, an advanced user will know how to do this from the command-line (see GNU/Linux Command-Line Tools Summary for a compact summary of command-line tools in Linux).

Figure 3-24. Red Hat: Service Configuration Panel.

Red Hat: Service Configuration Panel.

The activation or restart of the service we are interested in takes place by selecting the appropriate entry for that service in the Service Configuration Panel (httpd is the service for Apache, while mysqld is the service for MySQL), then click on "activate" or "restart" respectively (Figure 3-24).

Note that in order for our changes in PHP to take effect, we will have to restart Apache.

Now you can connect to your server by pointing your browser to http://localhost or to

Tip Apache and the hosts file

If the Apache service does not start, it may be because it cannot resolve "localhost" correctly. This name for the local computer is given the IP address in the hosts file (usually under /etc). You can try to change localhost.localdomain localhost

in /etc/hosts to: dhcppc0 localhost.localdomain localhost

The folder that is expected to hold the HTML files is again /var/www/html. Note that, again, in order for the normal user to be able to modify the HTML files, you will have to change the permissions of that folder to 777 (see Section 3.2.3).

It is also comfortable to create a link to that folder on the client's desktop, so that he does not have to click his way through the path each time.

You can syndicate our News with backend.php And our Forums with rss.php
You can also access our feeds via Feedburner Site News and LD Software Forums
© 2009 ld-software.co.uk All Rights Reserved.
PHP-Nuke Copyright © 2005 by Francisco Burzi. This is free software, and you may redistribute it under the GPL. PHP-Nuke comes with absolutely no warranty, for details, see the license.
Page Generation: 0.33 Seconds