Install Apache and PHP under Linux; Apache+php+mysql Configuration Introduction _ Server

Source: Internet
Author: User
Tags mysql client vars
1.apache
Download the Apache for Linux source package on the following page
http://www.apache.org/dist/httpd/;
Save to/home/xx directory, XX is a self-built folder, I built a WJ folder.

List of commands:
Cd/home/wj
TAR-ZXVF httpd-2.0.54.tar.gz
MV httpd-2.0.54 Apache
CD Apache
./configure--prefix=/usr/local/apache2--enable-module=so
Make
Make install
Install Apache to/usr/local/apache and configure Apache to support DSO mode
2.php
Download the PHP for Linux source package on the following page
http://www.php.net/downloads.php;
Save to/HOME/WJ Directory
List of commands:
Cd/home/wj
TAR-ZXVF php-5.0.4.tar.gz
MV php-5.0.4 PHP
CD PHP
./configure--PREFIX=/USR/LOCAL/PHP5--with-apxs2=/usr/local/apache2/bin/apxs--with-config-file-path=/usr/local/ Lib--enable-track-vars--with-xml--with-mysql
Make
Make install
Where Apache and MySQL are changed according to the directory name you installed, I'm =/usr/local/apache2/bin/apxs and MySQL.
CP Php.ini-dist/usr/local/lib/php.ini
Install the PHP to/usr/local/php in DSO mode set profile directory for/usr/local/lib open Mysql,xml support
3. Configure
Vi/usr/local/apache/conf/httpd.conf
Make the following configuration for Apache
#将ServerAdmin mailto:linux@linuxidc.com line to your e-mail address

#DocumentRoot "/home/httpd/html/" Here for the HTML file home directory
# ditto
#Options followsymlinks multiviews for safety, remove "Indexes"
#
# directoryindex default.php default.phtml default.php3 default.html default.htm
#
#设置apache的默认文件名次序
#AddType application/x-httpd-php. php. phtml. PhP3. Inc
#AddType Application/x-httpd-php-source. Phps
#设置php文件后缀
Disk exit
Vi/usr/local/lib/php.ini
#register-golbals = On
Disk exit
4. Start Service
/usr/local/apache/bin/apachectl start
  
5. Test
Then write a PHP test page info.php: The contents are as follows
〈?php
Phpinfo ();
?>
Normal, should be able to see the information of PHP, congratulations on your apche+mysql+php installation success.
6, Apache automatic start--
The following is an example of starting Apache;
Self-starter script:
/usr/local/apache/bin/apachectl start
The file is located under/etc/rc.d/init.d, named Apached, and note that you want to perform it.
#chmod +x/etc/rc.d/init.d/apached//settings file properties are executable
#ln-S/etc/rc.d/init.d/apached/etc/rc3.d/s90apache//build soft connections, shortcuts
#ln-S/etc/rc.d/init.d/apached/etc/rc0.d/k20apache


Detailed Introduction: Apache+php+mysql Configuration Strategy

First, the system requirements:

This system is tested through the REDHAT7.2 version

Second, the server-side software requirements:

1: Download Apache Web SERVER http://www.apache.org/to Apache's network station

2. Download PHP parser to PHP's Web site http://www.php.net/

3. Download MySQL http://sourceforge.net/projects/mysql/to MySQL website

Three Installing the Debug Web SERVER

Download the above files and put them in the same directory, I put them under the/usr/local, and use the tar command to unpack the files.



Tar zxvf apache_1.3.12.tar.gz
Tar zxvf php-4.0.6.tar.gz
Tar zxvf mysql-3.22.40.tar.gz

To facilitate installation it is recommended that the directory name



#mv apache_1.3.12 Apache
#mv php-4.0.6 PHP
#mv mysql-3.22.40 MySQL

installing MySQL

Four. You can install MySQL before you install the Web service



CD MySQL
./configure
Make
Make install

According to the performance of the machine, the compilation process takes a certain amount of time, after compiling the system defaults to install the MySQL under the/usr/local.

Once the installation is complete, start the MySQL process.
Cd/usr/local/bin

./mysql_install_db (Basic database for MySQL installation)

./safe_mysqld & (Start the process up and into the background)

MySQL is here to calculate the installation completed, try running./mysql See if you can link to the database, if normal, you should be able to see such an interface



Welcome to the MySQL monitor.commands end with; or G.
Your MySQL Connection ID is 880 to server version:3.22.40
Type ' help ' for help.
Mysql>

Here, congratulations on your MySQL installation.

The use of MySQL you can refer to his Doc document

Five. Integrate Apache, PHP4

This is the key to all work, but also the most difficult step, may be due to the different version of the installation process there is such a mistake, you can make appropriate changes according to the version information.

First CD Apache

./configure

This seems to be dispensable, but I had to make a mistake because I didn't do it.



Cd.. /php
./configure--with-mysql=/usr/local--with-apache=/usr/local/apache--enable-track-vars
Make
Make install
Cd.. /apache
./configure--activate-module=src/modules/php4/libphp4.a
Make
Make install

This step is to install the Apache Web service, and you can look at it./configure–help Add the modules you need, or install them by reference to the installation manual.

Copy the PHP configuration file to the appropriate directory

Cd.. /php

CP Php.ini-dist/usr/local/lib/php.ini

PHP.ini Basic can not make any changes, to modify can refer to the corresponding instructions.

Configure the Apache WEB server when you are finished configuring PHP, configure the httpd.conf first

Cd/usr/local/apache/conf

VI httpd.conf

For PHP to modify the following:

# AddType application/x-httpd-php. php

# AddType Application/x-httpd-php-source. Phps

The above two lines to remove the annotation, and according to the actual situation to determine the name of the PHP document suffix, according to the needs of Horde, we recommend that the first line to the following form

AddType application/x-httpd-php. php. php3. htm. phtml. php4

In addition to modify the system default home type, the proposed DirectoryIndex index.htm changed to this:

DirectoryIndex index.htm index.html index.php3 index.php default.php


New mysql+apache+php Linux Installation Guide

The new version of the old edition is still a little different. Now, post the steps.



Installation steps:

1.mysql

Download the MySQL for Linux rpm package on the following page
http://www.mysql.com/downloads/down...3.52-1.i386.rpm
http://www.mysql.com/downloads/down...3.52-1.i386.rpm

Save to/home/tmp Directory

List of commands:


Cd/home/tmp
RPM-IVH mysql-3.23.52-1.i386.rpm #安装mysql Server
RPM-IVH mysql-client-3.23.52-1.i386.rpm #安装mysql Client
/usr/mysql/safe_mysqld & #启动mysql Server
MySQL #运行mysql the client and opens the root user's remote access permission. For debugging
Use MySQL
Update user Set host = '% ' where user = ' root ' and host <> ' localhost ';
Flush privileges;
Quit


This MySQL installation is complete

2.apache

Download the Apache for Linux source package on the following page

Http://www.apache.org/dist/httpd/apache_1.3.26.tar.gz

Save to/home/tmp Directory

List of commands:


Cd/home/tmp
TAR-ZXVF apache_1.3.26.tar.gz
MV Apache_1.3.26.tar.gz Apache
CD Apache
./configure--prefix=/usr/local/apache--enable-module=so
Make
Make install


Install Apache to/usr/local/apache and configure Apache to support DSO mode

3.php

Download the PHP for Linux source package on the following page

Http://www.php.net/get_download.php?df=php-4.2.3.tar.gz

Save to/home/tmp Directory

List of commands:


Cd/home/tmp
TAR-ZXVF php-4.2.3.tar.gz
MV php-4.2.3.tar.gz PHP
CD PHP
./configure--prefix=/usr/local/php--with-apxs=/usr/local/apache/bin/apxs--with-config-file-path=/usr/local/lib --enable-track-vars--with-xml--with-mysql
Make
Make install
CP Php.ini-dist/usr/local/lib/php.ini


Install the PHP to/usr/local/php in DSO mode set profile directory for/usr/local/lib open Mysql,xml support

4. Configure

Vi/usr/local/apache/conf/httpd.conf
Make the following configuration for Apache
#将ServerAdmin q3boy@younet.com line to your e-mail address

#DocumentRoot "/home/httpd/html/" Here for the HTML file home directory

# ditto

#Options followsymlinks multiviews for safety, remove "Indexes"

#
# directoryindex default.php default.phtml default.php3 default.html default.htm
#
#设置apache的默认文件名次序

#AddType application/x-httpd-php. php. phtml. PhP3. Inc
#AddType Application/x-httpd-php-source. Phps
#设置php文件后缀



Disk exit

Vi/usr/local/lib/php.ini
#register-golbals = On


Disk exit

5. Start Service
/usr/local/apache/bin/apachectl start

6. Notes
Apache's default maximum number of processes under Linux is 256, no matter how modified httpd.conf can exceed this limit. If you want to increase this limit, edit/home/tmp/apache/src/include/httpd.h before compiling Apache, and change the #define HARD_SERVER_LIMIT 2,561 lines to #define Hard_ Server_limit 2048 before compiling Apache,

Mod_so seems to be no longer the default module in Apache 1.3.26. Compile time need to add--enable-module=so, my first compilation did not add this parameter, the result of PHP compile can not find APXS

The default profile path in PHP 4.2.3 seems to have changed. Compile-time need to add--with-config-file-path=/usr/local/lib parameters, I compiled the first php.ini put n places are no use. Forced You can only add this parameter.

P.S. does not guarantee that the steps described in this article apply to other versions

Attached: Related documents download address

Php:
Http://www.php.net/get_download.php?df=php-4.2.3.tar.gz
Apache:
Http://www.apache.org/dist/httpd/apache_1.3.26.tar.gz
MySQL server:
http://www.mysql.com/downloads/down...3.52-1.i386.rpm
MySQL client:
http://www.mysql.com/downloads/down...3.52-1.i386.rpm
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.