Home >Backend Development >PHP Tutorial >Installation and configuration of Apache 2.2, MySQL 5.0 and PHP 5.0 under Linux_PHP tutorial
1. Installation environment
Operating system: Red Hat Linux Enterprise AS 4.0
Database: MySQL 5.0.24
Web server: Apache 2.2.3
Scripting language: PHP 5.1.6
2. Install MySQL 5.0.24
-------------Download the software package mysql-5.0.24.tar.gz, address http://www.mysql.com-------------
# tar zvxf mysql-5.0.24.tar.gz //Decompress
# cd mysql-5.0.24 //Enter the decompressed file directory
# ./configure --prefix=/usr/local/mysql //Set the installation directory
--enable-thread-safe-client //Compile the thread-safe version of the client library
--without-debug //Turn off debug function
--localstatedir=/data/mysqldata //Set database file directory
# make //Compile
# make install //Install
# /usr/local/mysql/bin/mysql_install_db //Initialize authorization
# chown –R root:root /usr/local/mysql //Change the file attributes to the root user
# cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf //Copy configuration file
----------------------------------Start the MySQL service------------- --------------------------
# /usr/local/mysql/bin/mysqld_safe --user=root & //Start MySQL
----------------------------------Change MySQL password------------- --------------------------
# /usr/local/mysql/bin/mysqladmin -uroot password mysqlsecret //Change password
----------------------------------Close the MySQL service------------- --------------------------
# /usr/local/mysql/bin/mysqladmin -uroot -pmysqlsecret shutdown //Shut down MySQL
3. Install Apache 2.2.3
-------------Download the software package httpd-2.2.3.tar.gz, address http://www.apache.org-------------
# tar zvxf httpd-2.2.3.tar.gz
# cd httpd-2.2.3
# ./configure --prefix=/usr/local/apache
--enable-module=most
--enable-shared=max
# make
# make install
----------------------------------Start the Apache service------------- --------------------------
# /usr/local/apache/bin/apachectl start
----------------------------------Close the Apache service------------- --------------------------
# /usr/local/apache/bin/apachectl stop
----------------------------------Restart the Apache service------------- --------------------------
# /usr/local/apache/bin/apachectl restart
4. Install PHP 5.1.6
------------------Download the software package php-5.1.6.tar.gz, address www.php.net--------------------- --------
# tar zvxf php-5.1.6.tar.gz
# cd php-5.1.6
# ./configure --prefix=/usr/local/php
--with-mysqld=/usr/local/mysql
--with-apxs2=/usr/local/apache/bin/apxs
# make
# make install
# cp php.ini-dist /usr/local/php/lib/php.ini
5. Configure the httpd.conf file of the Apache service
*Add LoadModule php5_module module/libphp5.so
at LoadModule
*Add index.php
at DirectoryIndex
*Add
at AddType application
AddType application/x-httpd-php .php .phtml
AddType applicatoin/x-httpd-php-source .phps