Web Server apache + mysql + php settings

Source: Internet
Author: User
Web Server apache + mysql + php settings-Linux Enterprise Application-Linux server application information, the following is a detailed description. Web Server Settings
Apache + mysql + php is generally considered to be an excellent combination of web servers. It is ideal for individual lab servers and medium-sized servers. For large servers, I don't know how many pages are written in the php language, mainly because the execution efficiency of php pages is not very good, but even so, the apache server is still one of the most widely used servers. mysql does not have to say that, network-based databases are excellent. I have read a lot of articles about this on the Internet before. Although I wrote it in detail, I only succeeded once according to the above method. Many people say they have succeeded in the experiment, but in fact many people have lost some steps. The following article is based on an article and made a lot of modifications by myself.

Apache + mysql + php in Linux

Apache1.3.28 + php-4.3.3 + mysql-4.0.16
Note that the static php module can be used for apache 1.3.x.
The required software package for this installation:
Apache_1.3.28.tar.gz
Php-4.3.3.tar.bz2
MySQL-client-4.0.16-0.i386.rpm
MySQL-devel-4.0.16-0.i386.rpm
MySQL-server-4.0.16-0.i386.rpm
MySQL-shared-4.0.16-0.i386.rpm


0. Before installation:

First, uninstall the server software that comes with the debugging system. Because apache must be re-compiled, php does not bring the original system. As for mysql, if it has been installed during initial installation of the system, you may not install it here, but I promise, this is a bit newer than what you brought ~~ :).

Uninstall apache: rpm-e apache. If it fails, add the -- nodeps parameter.

Uninstall mysql: Run rpm-qa | grep MySQL to check the software package installed in the system.

If MySQL software packages are listed, uninstall them one by one. Note that the -- nodeps and -- force parameters are added because they are mutually dependent and cannot be unloaded without parameters:

Rpm-e MySQL-client -- nodeps -- force
Rpm-e MySQL-server -- nodeps -- force
Rpm-e MySQL-shared -- nodeps -- force
Rpm-e MySQL-devel -- nodeps -- force
Rpm-e mysql

If you do not want to uninstall it, you can.

The installation is started below.

1. Install mysql: (skip this step if you do not intend to uninstall the original mysql)

Put these packages in a directory, such as your main directory/root

A. Create a MySQL user group: (if the system has already established users and groups, this step will not succeed, but it does not matter. You can proceed directly to the next step)

Groupadd mysql
Useradd-g mysql

B. Install mysql

Rpm-ivh MySQL-client-4.0.16-0.i386.rpm
Rpm-ivh MySQL-devel-4.0.16-0.i386.rpm
Rpm-ivh MySQL-server-4.0.16-0.i386.rpm
Rpm-ivh MySQL-shared-4.0.16-0.i386.rpm

C. Start

Mysqld_safe &

D. Set the password for the root user.

Mysqladmin-u root-p password

After you press enter, the system will prompt you to enter the current password, which should be like the following:

Enter password:

Because there is no password, press enter and enter your_password.

E. Shut down the mysql server.

Mysqladmin-u root-p shutdown

After you enter the password, the system prompts that MySQL is disabled.

2. install apache + php

1) Configure apache

A. Decompress apache_1.3.28.tar.gz

Tar zxvf apache_1.3.28.tar.gz

B. Configure and pre-compile apache. It is mainly because apache must be compiled during php compilation, so it is only compiled without installation.

Cd apache_1.3.28
./Configure -- prefix =/usr/local/apache
Make

2) configure the compilation and installation php-4.3.3

A. Decompress php-4.3.3.tar.bz2

Tar zxvf php-4.3.3.tar.bz2

Cd php-4.3.3

./Configure -- with-mysql =/usr/local/mysql -- with-apache = ../apache_1.3.28 -- enable-track-vars -- enable-inline-optimiation -- enable-dio

The following three parameters can be left blank, but used for optimization and loading certain modules.

B, then compile and install:

Make; make install

3) to reconfigure and compile and install apache, copy libphp4.a libphp4.la to apache.

Cd ../apache_1.3.28

Cp ../php-4.3.3/libs/* src/modules/php4/

. /Configure -- prefix =/usr/local/apache -- activate-module = src/modules/php4/libphp4.a -- enable-module = php4 -- enable-module = most -- enable-shared = max

Make; make install

4) Final settings

A. Install the php configuration file:

Cd./php-4.3.3
Cp php. ini-dist/usr/local/lib/php. ini

You can edit php. ini as needed

B. Edit httpd in the/usr/local/apache/conf directory. conf (this file involves all the server variables. You can change the server address, port, and main directory. The following list must be changed)

Find:

DirectoryIndex index.html


Changed:

DirectoryIndex index.html index. php index.htm


Add one to the file:
AddType application/x-httpd-php. php

C. Create a symbolic connection to control the server:

Ln-s/usr/local/apache/bin/apachectl/usr/bin/apache

The setting is complete.

5) debugging

You can write a simple php test page:

File Content:



Save it as index. php, copy it to/usr/local/apache/htdocs/(this is the default web server home directory), then start the mysql server and start the web server.

Mysqld_safe &
Apache start

Visit the test page. If all the server information is printed, it indicates that you have succeeded.
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.