Installing Apache, PHP, and MySQL on rhel5.1

Source: Internet
Author: User
Installing Apache, PHP, and MySQL on rhel5.1


This will install the basic components for a dynmaic, database-driven web site. We use
Yum to handle dependencies and gather all of the required packages.

1. install Apache (httpd), PHP, MySQL (server and client), and the component that allows
PHP to talk to MySQL.

 
Yum-y install httpd PHP MySQL mysql-server PHP-MySQL

2. Configure the new services to start automatically

 
/Sbin/chkconfig httpd on
/Sbin/chkconfig -- add mysqld
/Sbin/chkconfig mysqld on


/Sbin/service httpd start
/Sbin/service mysqld start


3. Important! Set up the MySQL Database Root Password. Without
Password, any user on the box can login to MYSQL as database root.
MySQL Root Account is a separate password from the machine Root
Account.

Mysqladmin-u Root Password 'new-password' [quotes are required]

4. Make additional security-related changes to MySQL.

 
Mysql-u root-P

Mysql> drop database test; [Removes the test database]
Mysql> Delete from mysql. User where user = ''; [Removes Anonymous Access]
Mysql> flush privileges;

5. Following the above steps, the document root for Apache is/var/www/html/

Create a test PHP script (such as phpinfo. php) and place it in the document root. A useful
Test script sample:

 
<? PHP
Phpinfo ();
?>

6. Create a database and database user for your data. You will use this database and user name
In your database connection string. The grant statement actually creates a new MySQL user account.

 mysql> Create Database web_db; 
mysql> grant all privileges on web_db. * To 'web _ user' @ 'localhost' identified by 'thepassword';

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.