Integrated Installation of Apache2 + PHP + MySQL in Linux

Source: Internet
Author: User
Tags apc
In Linux, Apache2 + PHP + MySQL Integrated Installation-Linux Enterprise Application-Linux server application information. The following is a detailed description. Running Environment: RedHat 7.3
Software: Apache2.0.40 http://www.apache.org/dist/httpd/httpd-2.0.40.tar.gz
PHP4.3DEV http://snaps.php.net/php4-latest.tar.gz
Http://mysql.hjc.edu.sg/Downloads/M...-3.23.52.tar.gz MySQL3.23.52

1. Install apache2
Copy httpd-2.0.40.tar.gz to the/usr/local/src directory.
# Tar zxvf httpd-2.0.40.tar.gz
# Cd httpd-2.0.40
#./Configure -- prefix =/usr/local/apache -- enable-mod = shared = all -- enable-module = so -- disable-info
# Make
# Make install
# Vi/usr/local/apache/conf/httpd. conf
Save and exit after changing ServerName
Next, set the self-start and running level of apache.
# Cd/etc/rc. d/init. d
# Sed's/sbin \/atd/local \/apache \/bin \/httpd/G' atd> httpd
# Sed's/atd/httpd/G' httpd>/tmp/txt
# Sed's/at daemon/httpd daemon/G'/tmp/txt> httpd
# Rm-f/tmp/txt
# Chmod 755 httpd
# Chkconfig -- level 345 httpd on
# Chkconfig -- level 0126 httpd off
Start and close the httpd service
#/Etc/rc. d/init. d/httpd start/stop/restart

2. Install MySQL
I am not in favor of starting MySQL with root. Therefore, first create a user named mysqluser to start MySQL, not in/etc/rc. d. local.
Copy mysql-3.23.52.tar.gz to the/usr/local/src directory.
# Tar zxvf mysql-3.23.52.tar.gz
# Groupadd mysql
# Useradd-g mysql
#. /Configure -- prefix =/usr/local/mysql -- localstatedir =/home/data -- with-client-ldflags =-all-static -- with-mysqld-ldflags =-all-static -- with-mysqld-user = mysql -- enable-consumer er -- with-extra-charsets = all
In this configuration, I have moved the data folder to the/home directory.
# Make
# Make install
# Scripts/mysql_install_db
# Chown-R root/usr/local/mysql
# Chown-R mysql/home/data
# Chgrp-R mysql/usr/local/mysql
# Cp support-files/my-medium.cnf/etc/my. cnf
# Cd/usr/local/mysql
# Bin/safe_mysqld &
# Bin/mysqladmin-u root password "123"
# Bin/mysqladmin-u root-h linux password "123"
Change the root password of the host to 123 For MySQL on linux.
# Vi/etc/rc. d/rc. local
Add su mysqluser-c "/usr/local/mysql/share/mysql. server start" at the end"
Save and exit
To stop MySQL, run
#/Usr/local/mysql/share/mysql. server stop

3. install PHP
The PHP version on the current official website cannot be integrated with Apache2, you must first download the latest PHP development version on the http://snaps.php.net. This site is a new version integrated with Apache2 developed by the PHP team and is updated every day.
Copy php4-latest.tar.gz to the/usr/local/src directory.
# Tar zxvf php4-latest.tar.gz
# Cd php4-200208212100 (directory will be different)
#. /Configure -- prefix =/usr/local/php -- with-mysql =/usr/local/mysql -- with-mail -- with-apxs2 =/usr/local/apache/bin/apxs -- enable-track-vars
# Make
# Make install
# Cp php. ini-recommended/usr/local/php/lib/php. ini
Although many articles Use php. ini-dist as configuration files, I prefer recommended for security reasons. Pai_^

4. Update the Link Library and add PHP Recognition
# Vi/etc/ld. so. conf
Add/user/local/mysql/lib at the end
Save and exit
# Ldconfig
# Vi/usr/local/apache/conf/httpd. conf
Add the following statement at an appropriate location to identify the PHP File
AddType application/x-httpd-php. php
LoadModule php4_module modules/libphp4.so
Add index. php after DirectoryIndex

Note: some articles on the Internet use the Filter Pattern for PHP recognition. the following statement:
AddType text/html. php
AddInputFilter PHP. php
AddOutputFilter PHP. php
However, I have repeatedly verified that the current version cannot identify PHP using the Filter pattern, and the LoadMoudle method is still required. Or the author's operation is incorrect. If you succeed, please let me know.

Now, Apache2 + PHP + MySQL integration in Linux is complete. Pai_^





Sup
Administrator





Points 1432
Post 1309
Register
#2

Software mysql-standard-4.1.7-pc-linux-i686.tar.gz?apache_1.3.31.tar.gz libxml2-2.6.11.tar.gz?php-5.0.0.tar.gz

1. Install mysql
# Groupadd mysql
# Useradd-g mysql
# Cd/root
# Tar zxvf mysql-standard-4.1.7-pc-linux-i686.tar.gz
# Music mysql-standard-4.1.7-pc-linux-i686 mysql
# Mv mysql/usr/local
# Cd/usr/local/mysql
#./Scripts/mysql_install_db -- user = mysql
# Chown-R root.
# Chown-R mysql data
# Chgrp-R mysql.
#./Bin/mysqld_safe -- user = mysql &
#./Bin/mysqladmin-u root password 'Password'
* Use mysqladmin to change the root password to 'Password'
* Automatic operation upon system startup:
# Cp support-files/mysql. server/etc/rc. d/init. d/mysqld
* If mysqld exists, corresponding options are available in ntsysv.
# Chkconfig -- add mysqld
* Set ntsysv to enable mysql to run automatically at each startup.
* After mysql is installed, you can start your mysql service in this way.
#/Etc/rc. d/init. d/mysqld start

Note:
1. If mysql cannot run under #, run it under/usr/local/mysql/bin./mysql
The command is as follows:./mysql-hlocalhost-uroot-p021011
2. The mysqlcc connection is not authenticated by default.
Run the following command:
Mysql> grant all privileges on *. * to root@192.168.1.109 identified by "021011 ";

2. install apache
# Cd/root
# Tar zxvf apache_1.3.31.tar.gz
# Cd apache_1.3.31
#./Configure -- enable-module = so -- prefix = PREFIX
* Mod_so in apache 1.3.31 does not seem to be the default module. -- Enable-module = so must be added during compilation. this parameter is not added during the first compilation, and cannot be found during php compilation.

Apxs.
# Make
# Make install

Note:
1. You may need to uninstall redhat-config-httpd before using rpm-e.
2. Install gcc during compilation

3. Libxml2
Libxml2's library is 2.5.4. when an error is reported in the PHP configuration process, a newer libxml2-2.6.11.tar.gz is downloaded. We will install it below.

.
# Cd/root
# Tar zxvf libxml2-2.6.11.tar.gz
# Cd libxml2-2.6.11
#./Configure
# Make
# Make install

4. PHP
# Cd/root
# Tar zxvf php-5.0.0.tar.gz
# Cd php-5.0.0
#./Configure -- with-apxs =/usr/local/apache/bin/apxs -- with-mysql =/usr/local/mysql
# Make
# Make install

After the installation is complete, modify the apache configuration file httpd. conf.
Add on top
AddType application/x-httpd-php. php
AddType application/x-httpd-php-source. phps
AddType application/x-httpd-php. php3
Restart apache
Test PHP
Compile the info. php file with the following content:
Echo phpinfo ();
?>
Save it to the apache document path and enter the following in the browser:
Http: // 127.0.0.1/info. php





Sup
Administrator





Points 1432
Post 1309
Register
#3

1. Install mod_limitipconn first

2. Apache 2.0.55 Released compilation options
CODE: [Copy to clipboard]
--------------------------------------------------------------------------------

. /Configure -- prefix =/usr/local/apache2 -- enable-ssl -- enable-dav -- enable-cgi -- enable-so -- with-module = aaa :.. /mod_limitipconn-0.22/mod_limitipconn.c
3. php 5.0.5
CODE: [Copy to clipboard]
--------------------------------------------------------------------------------

. /Configure -- prefix =/usr/local/mysql -- with-client-ldflags =-all-static -- with-mysqld-user = mysql -- enable-Cycler
Cp./php. ini-recommended/usr/local/php5/lib/php. ini
Ln-s/usr/local/php5/lib/php. ini/etc/php. ini
4. mysql 4.0.26
CODE: [Copy to clipboard]
--------------------------------------------------------------------------------

./Configure -- prefix =/usr/local/php5 -- with-apxs2 =/usr/local/apache2/bin/apxs -- with-mysql =/usr/local/mysql
5. apache conf/httpd. conf

Mod_limitipconn

MaxConnPerIP 3
NoIPLimit image /*


6. APC

./Configure -- enable-apc -- with-php-config =/usr/local/php5/bin/php-config

7. php. ini



Zend_extension = "/usr/local/php5/lib/php/extensions/no-debug-non-zts-20041030/php_apc.so"
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.