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.
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).
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:
Edit the php.ini file, so that PHP supports also files that start with "<?" - and not only those that start with "<?php".
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).
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 http://127.0.0.1.
|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 127.0.0.1 in the hosts file (usually under /etc). You can try to change
in /etc/hosts to:
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.
|Last updated Sun Aug 7 21:14:12 CEST 2005||Permalink: http://www.karakas-online.de/EN-Book/red-hat-linux-apache-php-mysql.html||All contents © 2004 Chris Karakas, Claudio Erba|