Notes on PhP5 + mysql5 + Apache 2 under Linux

Source: Internet
Author: User

It has been installed many times, but I still think it is better to take notes. The environment is Red Hat Linux 4 + mysql5 + Apache 2 + PhP5
1. install Apache

 

Tar zvxf httpd-2.0.46.tar.gz

CD httpd-2.0.46

./Configure -- prefix =/usr/local/apache2 -- enable-SO \
-- Enable-mod-shared = most &&
Make &&
Make install

 

Set automatic Apache startup

Add/usr/local/Apache/apachectl start to/etc/rc. d/rc. Local.

 

2 install mysql5

First, of course, We decompress tar xzvf xxx.gz.

./Configure -- prefix =/usr/local/MySQL

Make & make install

Modify related permissions,
CP support-files/my-medium.cnf/etc/My. CNF

Create mysql users and groups:

Code:

# Groupadd MySQL
# Useradd-G MySQL

After completing the preceding operations, initialize the database and enter the installed MySQL directory.

Code:

# Cd/usr/local/MySQL
# Bin/mysql_install_db -- user = MySQL | Note: -- user = MySQL initializes the table and requires mysql users
Set access permissions for MySQL and root users. First, go to the MySQL directory.

Code:

# Cd/usr/local/MySQL
# Chown-r root/usr/local/MySQL | Note: Set root to access/usr/local/mysq
# Chown-r MySQL/usr/local/MySQL/var | Note: Set mysql users to access/usr/local/MySQL/var.
# Chgrp-r MySQL/usr/local/MySQL | Note: Set the MySQL group to access/usr/local/mysq.
Start MySQL and enter the installed directory

Code:

# Cd/usr/local/MySQL
# Bin/mysqld_safe -- user = MySQL &

Modify the default password of the root user of the MySQL database:
/Usr/local/MySQL/bin/mysqladmin-u Root Password 'new password'

Disable MySQL Server
CD/usr/local/MySQL/bin
./Mysqladmin-u root-P Shutdown

Set MySQL to start upon startup and go to the source code directory.

# Cd/home/seal/MySQL
# Cp support-files/MySQL. Server/etc/init. d/MySQL

# Chmod + x/etc/init. d/MySQL
# Chkconfig -- level 345 MySQL on
# Service MySQL restart
Shutting down mysql. [OK]
Starting MySQL [OK]

 

3. install PHP

Tar zvxf php5.tar.gz

./Configure -- prefix =/usr/local/PHP -- With-mysql =/usr/local/MySQL \
-- With-apxs2 =/usr/local/Apache/bin/apxs &&
Make &&
Make install

 

Cp php. ini-Dist/usr/local/PhP5/etc/PHP. ini
VI/usr/local/PhP5/etc/PHP. ini
Remove the # Above extension = php_mysql.dll
Of course, you can also remove other things.

4. Modify httpd. conf
Add
   

Addtype application/X-httpd-PHP. php
Addtype application/X-httpd-PHP-source. PHPs

To display Chinese characters,
Modify:

Adddefacharcharset gb2312

 

Set virtual directory
Alias/myphp "/home/myphp /"
<Directory "home/myphp/">
AllowOverride none
Order deny, allow
</Directory>

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.