How to install Apache + PHP on a Linux server

Source: Internet
Author: User
LAMPLinux + Apache + Mysql + PHP this architecture is a group of open source software for building dynamic websites or servers. Linux refers to the operating system (Hongqi, slackware, and Little Red Hat series). Apache is a web server. Mysql is a database management system, or a database server. php scripting language 1. installation environment Operating system: RedHat LAMP = Linux + Apache + Mysql + PHP
This architecture is a group of open-source software that builds dynamic websites or servers.
Linux refers to the operating system (Red Flag, slackware, and Red Riding Hood series)
Apache is a web server
Mysql is a database management system or database server.
Php scripting language

1. installation environment
Operating system: Red Hat Linux Enterprise AS 4.0
Database: MySQL 5.0.24


Web server: Apache 2.2.3
Script language: PHP 5.1.6


2. install MySQL 5.0.24
-------------Download software package mysql-5.0.24.tar.gz, address http://www.mysql.com -------------
# Tar zvxf mysql-5.0.24.tar.gz // Extract
# 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 client library of thread Security Edition
-- Without-debug // disable the debug function
-- Localstatedir =/data/mysqldata // www.linuxidc.com set the 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 attribute to the root user
# Cp/usr/local/mysql/share/mysql/my-medium.cnf/etc/my. cnf // Copy the configuration file
---------------------------------- Start the MySQL service ----------------------------------
#/Usr/local/mysql/bin/mysqld_safe -- user = root & // start MySQL
-------------------------------- Change the MySQL password ----------------------------------
#/Usr/local/mysql/bin/mysqladmin-uroot password mysqlsecret // change the password
---------------------------------- Close the MySQL service ----------------------------------
#/Usr/local/mysql/bin/mysqladmin-uroot-pmysqlsecret shutdown // close MySQL

3. install Apache 2.2.3
-------------Download 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 at 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 to LoadModule.
* Add index. php at DirectoryIndex
* Add in AddType application
AddType application/x-httpd-php. php. phtml
AddType applicatoin/x-httpd-php-source. phps
 
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.