CECS 5450

Internet Services

Spring 2005

Mysql and Php Install

# represents the shell prompt.

MySql Install

  • as root
  • Download mysql (mysql-standard-4.1.8-pc-linux-i686.tar) into
    /usr/local/src using web browser
  • # tar -xvf mysql-standard-4.1.8-pc-linux-i686.tar
    (creates mysql dir)
  • # ln -s /usr/local/src/mysql-standard-4.1.8-pc-linux-i686 /usr/local/mysql
  • # cd /usr/local/mysql
  • # groupadd mysql
  • # useradd -g mysql mysql
  • # scripts/mysql_install_db --user=mysql
  • # chown -R root /usr/local/mysql
  • # chown -R mysql /usr/local/mysql/data
  • # chgrp -R mysql /usr/local/mysql
  • # chown -R root /usr/local/mysql/bin
  • # ./bin/mysqld_safe --user=mysql &
  • # ./bin/mysqladmin -u root password '*****' (be sure to choose a secure password)
  • # ls /tmp/mysql.sock
  • If file does not exist, then you need to find it and link it from where it is to /temp/mysql.sock -- ask Dr. Jones
  • Edit /etc/rc.d/rc.local
  • Add the following two lines so that mysql will start on system boot:
    cd /usr/local/mysql
    bin/safe_mysqld --user=mysql &

    MySql Control Center

  • as root
  • Download mysqlcc (mysqlcc-0.9.4-linux-glibc22.tar) into /usr/local/src
  • # cd /usr/local/src
  • # tar -xvf mysqlcc-0.9.4-linux-glibc22.tar
    (creates mysqlcc dir)
  • cd mysqlcc-0.9.4-linux-glibc22
  • # ln -s /usr/local/src/mysqlcc /usr/local/bin/mysqlcc
  • # mysqlcc
  • mysqlcc application should start
    1. Name: <Your System Name>
    2. Host Name: localhost
    3. User Name: root
    4. Password: ****** (use the one you set above)
    5. Press TEST to Test connection, if correct then you should receive successful connection response.
    6. ADD to database.
    7. Double-click on Database
    8. Double-click on "User Admin"
    9. Double-click on each account and set the password for each of the accounts to '*******'. (set to a secure password) Repeat for all accounts.
    10. Close MySqlCC

    Apache2 Install

  • as root
  • Download apache2 (httpd-2.0.52.tar) into /usr/local/src
  • # cd /usr/local/src
  • # tar -xvf httpd-2.0.52.tar
    (creates httpd-2.0.52 dir)
  • # cd httpd-2.0.52
  • # ./configure --prefix=/usr/local/apache2 --enable-module=so
  • If no errors, then proceed:
  • # make
  • # make_install
  • # mv /usr/sbin/httpd /usr/sbin/httpd.old
  • # ln -s /usr/local/apache2/bin /usr/sbin/httpd
    (links new httpd into old location)
  • mv /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd.conf.old
  • ln -s /usr/local/apache2/conf/httpd.conf /etc/httpd/conf/httpd.conf
  • RedHat: System Settings: Server Settings: Services
  • Locate httpd
  • Click to select for statup, Press START or RESTART (depending on current configuration), Press Save
  • httpd should start
  • Close Service
  • Open Browser and go to system home page
  • You should see the default 2.0.52 pages
  • We now need to link in the /var/www area into the new apache2 htdocs area
  • # cd /usr/local/apache2
  • # mv htdocs htdocs.old
  • # ln -s /var/www/html /usr/local/apache2/htdocs
  • In order not to see a directory of files, we need to edit the /usr/local/apache2/conf/httpd.conf
  • Line 1044 should be: Options Indexes FollowSymLinks
  • Remove Indexes, so that an error will be reported instead of displaying an index of the html directory. This is a security consideration.
  • Restart the HTTPD services via the Fedora Services Control Dialog.

    PHP Install

  • as root
  • Download php-5.03 (php-5.0.3.tar) into /usr/local/src
  • # tar -xvf php-5.0.3
    (creates php-5.0.3)
  • # cd php-5.0.3
  • # ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql
  • Alternate Form -- in case you need graphics support and some other things:
    ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/apache2/bin/apxs --with-gd --enable-gd-native-tiff --with-png --with-zlib-dir=/usr/local/lib/zlib-1.2.1 --with-tiff --with-jpeg-dir=/usr/local/lib/jpeg-6b/ --with-freetype-dir=/usr/local/lib/freetype-2.1.9/ --with-xpm-dir=/usr/X11R6
  • make sure of no warning or errors
  • # make
  • make sure of no warning or errors
  • # make install
  • make sure of no warning or errors
  • # cp php.ini-dist /usr/local/lib/php.ini
  • edit /usr/local/apache2/conf/httpd.conf
    1. Make sure the line 'LoadModule php5_module modules/libphp5.so' is in the httpd.conf
    2. Add 'AddType application/x-httpd-php .php .phtml .html' around line 851 of the file.
  • Restart HTTPD service using Fedora Services Management Dialog.
  • Within the directory /var/www/html place a file called test.php, that contains the following HTML
  • <html><body>HTML TEST<?php phpinfo(); ?></body></html>
  • Open a Browser and enter http://<system name>/test.php
  • You you see the HTML TEST in text followed by the output for PHP 5. Be sure that MySQL is in the output as being defined. If MYSQL is not located in a file, then a previous step was done incorrectly.
  • MySQL, Apache2, and PHP are now configured and ready to work.