CentOS5.6 quick LAMP setup

Source: Internet
Author: User
CentOS 5.6 is installed under the virtual machine. Use the NAT mode to share the Internet with the host pc! Of course, you can build lamp by compiling the source code. This section describes how to quickly build a php development framework. In fact, there is nothing, mainly because the linux yum is used for online installation. If the above...

CentOS 5.6 is installed under the virtual machine. Use the NAT mode to share the Internet with the host pc!
Of course, you can build lamp by compiling the source code. This section describes how to quickly build a php development framework. In fact, there is nothing, mainly because the linux yum is used for online installation. If you cannot access the network, find the article that compiles the source code to build lamp. More than N haokao_^ on the Internet
1. install mysql database
Command line: yum-y install mysql-server
Setting up Install Process
Setting up repositories .......
........................................ ............
Installed: mysql-server.i386. 1.20-1. RHEL4.1
Dependency Installed: mysql. i386. 1.20-1. RHEL4.1 perl-DBD-MySQL.i386. 9004-3.1 perl-DBI.i386. 40-8
Complete!
After installation, configure mysql:
Command line: vi/etc/my. cnf prompt: The red word is the added line, mainly set the default character set of the database to utf8
[Mysqld]
Datadir =/var/lib/mysql
Socket =/var/lib/mysql. sock
User = mysql
# Default to using old password format for compatibility with mysql 3.x
# Clients (those using the mysqlclient10 compatibility package ).
Old_passwords = 1
Default-character-set = utf8
# Disabling symbolic-links is recommended to prevent assorted security risks;
# To do so, uncomment this line:
# Symbolic-links = 0
[Mysql]
Default-character-set = utf8
After saving and exiting, set the mysql service to start with the system,
Command line: chkconfig mysqld on
You can view the setting status through chkconfig -- list mysqld, and display mysqld 0: off 1: off 2: on 3: on 4: on 5: on 6: off, 2 ~ 5. show On.
 
Start mysql service,/etc/rc. d. init. d/mysqld start
Initializing MySQL database: [OK]
Starting MySQL: [OK]
You can log on to mysql for testing: mysql-u-root * (the default root password is blank)
After the prompt "mysql>" appears, set the root password.
The following actions are taken for security considerations:
Command line: mysql> use mysql;
Mysql> set password for root @ localhost = password ('your password ');
Mysql> set password for root@localhost.localdomain = password ('your password ');
Delete anonymous users: mysql> delete from user where user = '';
Delete the test database: mysql> drop database test;
Now, mysql data installation is complete. you can use SQL to perform mysql Testing.
2. install apache
Command line: yum-y install apache
Setting up Install Process
Setting up repositories
....................................
Complete!
Configure apache and edit the configuration file of Apache. run vi/etc/httpd/conf/httpd. conf in the command line.
#
# Don't give away too much information about all the subcomponents
# We are running. Comment out this line if you don't mind remote sites
# Finding out what major optional modules you are running
Find this line in ServerTokens OS kernel and change "OS" to "Prod" (the name of the server operating system is not displayed when an error page appears)
Bytes
ServerTokens Prod restart changes to this status
#
# Optionally add a line containing the server version and virtual host
# Name to server-generated pages (internal error documents, FTP directory
# Listings, mod_status and mod_info output etc., but not CGI generated
# Documents or custom error documents ).
# Set to "EMail" to also include a mailto: link to the ServerAdmin.
# Set to one of: On | Off | EMail
#
ServerSignature On login find this line and change "On" to "Off"
Bytes
ServerSignature Off warn does not display Apache version on the error page
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# It explicitly to prevent problems during startup.
#
# If this is not set to valid DNS name for your host, server-generated
# Redirections will not work. See also the UseCanonicalName directive.
#
# If your host doesn' t have a registered DNS name, enter its IP address here.
# You will have to access it by its address anyway, and this will make
# Redirections work in a sensible way.
#
# ServerName new. host. name: 80 modify the host name
Bytes
ServerName www.linuxidc.com: 80 slave is modified according to the actual situation, and the default port number is 80.
#
# Possible values for the Options directive are "None", "All ",
# Or any combination:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named * explicitly * --- "Options All"
# Doesn' t give it to you.
#
# The Options directive is both complicated and important. Please see
# Http://httpd.apache.org/docs-2.0/mod/core.html#options
# For more information.
#
DirectoryIndex index.html. var locate this line,
DirectoryIndex index.html index. php plugin add the default index. php file

Options Indexes FollowSymLinks found this line, delete "Indexes", and add "des" and "ExecCGI"
Bytes
Options shortdes ExecCGI FollowSymLinks allow the server to execute CGI and SSI
#
# AddHandler allows you to map certain file extensions to "handlers ":
# Actions unrelated to filetype. These can be either built into the server
# Or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive .)
#
# AddHandler cgi-script. cgi locate this line, remove "#" at the beginning of the line, and add ". pl" at the end of the line"
Bytes
AddHandler cgi-script. cgi. pl extension allows CGI scripts with the. pl extension to run.
#
# AllowOverride controls what directives may be placed in. htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None found this line and changed "None" to "All"
Bytes
AllowOverride All allow changes to this status, allow. htaccess
#
# Specify a default charset for all pages sent out. This is
# Always a good idea and opens the door for future internationalisation
# Of your web site, shocould you ever want it. Specifying it
# A default does little harm; as the standard dictates that a page
# Is in ISO-8859-1 (latin1) unless specified otherwise I. e. you
# Are merely stating the obvious. There are also some security
# Reasons in browsers, related to javascript and URL parsing
# Which encourage you to always set a default char set.
#
AddDefaultCharset UTF-8 found this line, add '#' at the beginning of the line
Bytes
# Adddefacharcharset UTF-8 ← do not use the UTF-8 as the default code for the web page
Adddefacharcharset GB2312 encode and add this line (add GB2312 as the default encoding)
Locate this tag and change the corresponding options in the tag
Options Indexes MultiViews locate this line and delete "Indexes"
Bytes
Options MultiViews changes to this status (the tree directory structure is not displayed on the browser)
AllowOverride None
Order allow, deny
Allow from all

Command line: chkconfig httpd on startup
Chkconfig -- list httpd
Httpd 0: off 1: off 2: on 3: on 4: on 5: on 6: off okay.
/Etc/rc. d/init. d/httpd start restart start HTTP service
Starting httpd: [OK] if the slave node is successfully started, OK will appear.
View http: // 127.0.0.1 in the browser and you will see the test page, indicating that the installation is successful. 3. install php
Command line: yum-y install php
Setting up Install Process
Setting up repositories
Reading repository metadata in from local files
...............................
..................
Installing: php-pear ######################### [2/2]
Installed: php. i386. 3.9-3.15
Dependency Installed: php-pear.i386. 3.9-3.15
Complete!
After installation, the configuration file is located in/etc/php. ini. You can modify the configuration.
4. test environment
Create a php file,
Command line: vi/var/www/html/test. php
Enter the code:
$ Host = 'localhost ';
$ User = 'root ';
$ Pwd = 'password ';
$ Link = mysql_connect ($ host, $ user, $ pwd );
If (! $ Link ){
Die ('connection failed ');
} Else {
Echo 'connection successful! ';
}
Mysql_close ($ link );
?>
Save and exit. in the browser, browse http: // 127.0.0.1/test. php to view the php information page.
So far, using yum online to quickly build a php environment on centos is complete.

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.