You can also build a lamp Development Environment on Red Hat Enterprise 6.0!

Source: Internet
Author: User
Tags php write xsl xslt apache log

Install and configure apache2.2.6 + php5.2.5 + mysql5.0.46 in redhatenterpriselinux6.0
Note:
The above software is only available on the Internet. The key is that the software version determined by the development environment is fixed, so the corresponding version must be found, it takes a long time to build the environment.

Be patient!

● Install and configure MySQL 5.0.46

 

CD/usr/local/src
# Tar xzvf mysql-5.0.46.tar.gz
# Cd mysql-5.0.46
Modify the maximum number of connections of the mysql client. The default value is only 100, which is far from our requirement.
# Vi SQL/mysqld. CC
Search for the following line:
{"Max_connections", opt_max_connections,
"The number of simultaneous clients allowed.", (gptr *) & max_connections,
(Gptr *) & max_connections, 0, get_ulong, required_arg, 100, 1, 16384, 0, 1,
0 },
Change the value of 100 to 1500. Of course, you can change it to a smaller value. It is not recommended to change it too much based on your needs.
{"Max_connections", opt_max_connections,
"The number of simultaneous clients allowed.", (gptr *) & max_connections,
(Gptr *) & max_connections, 0, get_ulong, required_arg, 1500, 1, 16384, 0, 1,
0 },
Save.
#. /Configure -- prefix =/usr/local/MySQL -- localstatedir =/var/lib/MySQL -- With-Comment = source -- With-server-suffix =-enterprise-GPL --- mysqld-user = MySQL -- without-Debug -- With-big-tables -- With-charset = utf8 -- With-collation = utf8_general_ci -- With-extra-charsets = all
-- With-pthread -- enable-static -- enable-thread-safe-client -- With-client-ldflags =-all-static -- With-mysqld-ldflags =-all-static -- enable -Cycler -- With-InnoDB -- With-NDB-Debug -- without-isam

Note the configuration file: With-InnoDB, with-NDB-Debug. MySQL can reference the InnoDB plug-in only after configuration. This plug-in is still quite popular in development !!!


If the configuration is successful, the following message is displayed:
MySQL has a web site
Http://www.mysql.com/
Which carries details on
Latest release, upcoming features, and other information to make your
Work or play with MySQL more productive. There you can also find
Information about mailing lists for MySQL discussion.
Remember to check the platform specific part of the reference manual
Hints about installing MySQL on your platform. also have a look at
Files in the docs directory.
Thank you for choosing MySQL!
# Make
Compilation may take a long time. After all, the optimization is quite powerful.
# Make install
After compilation and installation are complete, perform the following operations:
# Useradd MySQL // Add a MySQL user
# Cd/usr/local/MySQL
# Bin/mysql_install_db -- user = MySQL
# Chown-r root: mysql. // set the permission. Note that there is "."
# Chown-r MySQL/var/lib/MySQL // set MySQL Directory Permissions
# Chgrp-r mysql. // note that there is "."
# Cp share/MySQL/my-medium.cnf/etc/My. CNF
# Cp share/MySQL. Server/etc/rc. d/init. d/mysqld // automatically start MySQL upon startup.
# Chmod 755/etc/rc. d/init. d/mysqld
# Chkconfig -- add mysqld
#/Etc/rc. d/init. d/mysqld start // start MySQL
# Bin/mysqladmin-u Root Password "password_for_root"
# Service mysqld stop // close MySQL


● Compile and install Apache


# Cd/usr/local/src
# Tar zxvf httpd-2.2.6.tar.gz
# Cd httpd-2.2.6
Install APR and APR-util in sequence
# Cd srclib/APR
#./Configure -- prefix =/usr/local/APR -- enable-threads -- enable-other-child -- enable-static
# Make & make install
# CD ../APR-util
#./Configure -- prefix =/usr/local/APR-util -- With-Apr =/usr/local/APR/-- With-mysql =/usr/local/MySQL
# Make & make install
# Cd/usr/local/src/httpd-2.2.6
#. /Configure -- prefix =/usr/local/apache2 -- enable-mod-shared = all -- With-mysql =/usr/local/MySQL -- enable-Cache -- enable-file-Cache -- enable-Mem-Cache -- enable-disk-Cache -- enable-static-support -- enable-static-htpasswd
-- Enable-static-htdigest -- enable-static-rotatelogs -- enable-static-logresolve -- enable-static-htdbm -- enable-static-AB -- enable-static-checkgid -- enable-mod_cgi -- -Apr =/usr/local/APR/-- With-Apr-util =/usr/local/APR-util/
# Make
# Make install
Note:
./Configure // configure the source code tree
-- Prefix =/usr/local/apache2 // the prefix of the top-level installation directory of the system-independent file, which is also the Apache installation directory.
-- Enable-module = So // open the so module. The so module is the Apache core module used to provide DSO support.
-- Enable-mod-shared = All // compile all templates. You can remove them in httpd. conf if you do not need them.
-- Enable-Cache // supports caching
-- Enable-file-Cache // supports file caching.
-- Enable-Mem-Cache // supports memory cache.
-- Enable-disk-Cache // supports disk caching.
-- Enable-static-support // supports static connections (Dynamic connections by default)
-- Enable-static-htpasswd // use a static connection to compile htpasswd-manage user files for Basic Authentication
-- Enable-static-htdigest // use a static connection to compile htdigest-manage the user files used for digest Authentication
-- Enable-static-rotatelogs // use a static connection to compile the rotatelogs-pipeline log program for Rolling Apache logs
-- Enable-static-logresolve // use a static connection to compile logresolve-resolve the IP address in the Apache log as the host name
-- Enable-static-htdbm // use a static connection to compile htdbm-operate the DBM Password Database
-- Enable-static-AB // use a static connection to compile the AB-Apache HTTP Server Performance Testing Tool
-- Enable-static-checkgid // use a static connection to compile checkgid
-- Disable-cgid // disable the use of an external CGI daemon to execute the CGI script
-- Disable-CGI // disable compilation of CGI PHP
We no longer use the worker mode to compile Apache. The worker mode and PHP seem to have some inconsistencies and instability. Therefore, the default perfork mode is used.
Set Apache to auto-start upon startup:
Add a line to the/etc/rc. d/rc. Local file.
/Usr/local/apache2/bin/apachectl start
In this way, Apache will be started along with the system every time the system is restarted.
Or
# Cp/usr/local/apache2/bin/apachectl/etc/rc. d/init. d/httpd
Then add VI/etc/rc. d/init. d/httpd (#! /Bin/sh)
# Chkconfig: 2345 10 90
# Description: activates/deactivates Apache Web Server
Finally, run chkconfig to add Apache to the startup Service Group of the system:
# Chkconfig -- add httpd
# Chkconfig httpd on
Or:
# Echo '/usr/local/apache2/bin/apachectl start'>/etc/rc. d/RC. local // Add the call of apachectl to your system startup file.

● Compile PHP 5.2.5

1. freetds (solving the connection problem between PHP and MSSQL)
The specific installation is as follows:
Freetds Installation
# Tar-zxvf freetds-stable.tgz
# Cd freetds-0.63
#./Configure -- prefix =/usr/local/freetds # Make
# Make install
# Vi/etc/lD. So. conf:
/Usr/local/freetds/lib
Save and exit.
# Ldconfig reload the dynamic library list lD. So. conf
2. Install IIS6
Create directory
# Mkdir/usr/local/limit 6
# Mkdir/usr/local/partition 6/bin
# Mkdir/usr/local/IPv6/lib
# Mkdir/usr/local/latest 6/include
# Mkdir/usr/local/IPv6/man
# Mkdir/usr/local/IPv6/man/Man1
# Cd/root/soft
# Tar-zxf restart src.v6b.tar.gz
# Cd jpeg-6b
#./Configure -- prefix =/usr/local/defaults 6/-- enable-shared -- enable-static
# Echo $?
# Make;

# Make install

3. Install libpng
# Cd/root/soft
# Tar-zxf libpng-1.2.8.tar.gz
# Cd libpng-1.2.8
# Cp scripts/makefile. STD makefile
# Make; make install

4. Install FreeType
# Cd/root/soft
# Tar-zxf freetype-2.1.10.tar.gz
# Cd freetype-2.1.10
#./Configure -- prefix =/usr/local/FreeType
# Echo $?
# Make;

# Make install

5. Install the latest GD library
# Cd/root/soft
# Tar-zxf gd-2.0.33.tar.gz
# Cd gd-2.0.33
#. /Configure -- prefix =/usr/local/GD2 -- With-JPEG =/usr/local/versions 6/-- With-PNG -- With-zlib -- With-FreeType =/usr/local /FreeType/
# Echo $?
# Make;

# Make install

6. Install the latest curl Library
# Cd/root/soft
# Tar-zxf curl-7.15.0.tar.gz
#./Configure -- prefix =/usr/local/curl
# Echo $?
# Make;

# Make install

7. Because PhP5 requires libxml2 support, libxml2 is installed first.
# Cd/root/soft
# Tar-zxf libxml2-2.6.19.tar.gz
# Cd libxml2-2.6.19
#./Configure -- prefix =/usr/local/libxml2
# Echo $?
# Make;

# Make install

8. Install libxslt
# Cd/root/soft
# Tar-zxf libxslt-1.1.15.tar.gz
# Cd libxslt-1.1.15
#./Configure -- prefix =/usr/local/libxslt -- With-libxml-Prefix =/usr/local/libxml2
# Echo $?
# Make;

# Make install

Start installing PHP
# Tar-zxf php-5.0.5.tar.gz
# Cd php-5.05
#. /Configure -- prefix =/usr/local/PHP -- enable-mbstring -- with-apxs2 =/usr/local/apache2/bin/apxs -- With-pear =/usr/share/PHP -- with-bz2 -- With-mysql =/usr/local/MySQL/-- With-curl =/usr/local/curl -- enable-FTP -- With-libxml-Dir =/usr/local/ libxml2 -- With-expat-Dir =/usr/lib
-- Enable-soap -- With-XSL =/usr/local/libxslt -- enable-XSLT -- With-Gd =/usr/local/GD2/-- enable-Gd-native-TTF -- enable-Gd-JIS-Conv -- With-JPEG-Dir =/usr/local/defaults 6/-- With-zlib-Dir =/usr/lib -- With-PNG -- With-FreeType -Dir =/usr/local/FreeType -- With-config-file-Path =/etc
-- With-iconv -- disable-ipv6 -- enable-static -- enable-maintainer-ZTS -- enable-Zend-multibyte -- enable-inline-optimization -- enable-Zend-multibyte -- enable-sockets -- enable -Soap
# Echo $?
# Make
# Make install
The./configure
-- Prefix =/usr/local/PHP
-- With-apxs2 =/usr/local/Apache/bin/apxs
-- With-mysql =/usr/local/MySQL/
-- With-libxml-Dir =/usr/local/libxml2
Is a required Option
-- With-Gd =/usr/local/GD2/
-- With-JPEG-Dir =/usr/local/defaults 6/
-- With-PNG
-- With-zlib-Dir =/usr/lib
-- With-FreeType-Dir =/usr/local/FreeType
This is the configuration option for PHP to support the GD library
-- With-curl =/usr/local/curl supports curl Library
-- Enable-FTP support for opening FTP library functions
-- Enable-soap -- With-XSL =/usr/local/libxslt -- enable-XSLT
Let PHP support soap, which is usually used less and can be removed

# Cp PHP. ini-Dist/usr/local/lib/PHP. ini
# Vi/usr/local/lib/PHP. ini
Change register_globals = off to register_globals = on.
● Integration of Apache and PHP
1,
# Simple modification of VI/usr/local/httpd. conf modules
Add the following to the configuration file:
Addtype application/X-httpd-PHP. php. php3. PhP4. PhP5
2,
Search: (set the Web default file)
Directoryindex index.html
Replace:
Directoryindex index. php index.html index.htm // if the default file is not found in the web directory, httpd will execute/var/www/error/noindex.html
3,
Find this section:
# AllowOverride controls what directives may be placed in. htaccess files.
# It Can Be "all", "NONE", or any combination of the keywords:
# Options fileinfo authconfig limit
#
AllowOverride none
Change to AllowOverride all
Apache rewrite4 is allowed to start CGI # addhandler CGI-script. cgi is removed # CGI script service is enabled
If you want to run the. pl extension at the same time
Change:
Addhandler CGI-script. cgi. pl
#/Usr/local/httpd/bin/apachectl restart apahce Service
The PHP configuration of the Apache server is complete.
Configure re-import
/Etc/rc. d/init. d/xinetd restart
● Test Server
1. Test PHP
Go to the default Apache home directory/usr/local/httpd/htdocs, and create a test. php file under this directory.
# VI test. php write with one content

The address/phpinfo. php shows the relevant service information.
2. test CGI
# Cd/usr/local/apache2/
# Chmod 755 cgi-bin
# Cd cgi-bin
# Chmod 755 test-cgi
Or compile the following code in the Apache website directory:
# VI test. cgi

[#! /Usr/bin/perl
Print "Content-Type: text/html \ n ;";
Print "Hello world \ n"

3. Test the database

In Windows, you can use MySQL-front to connect to your configured MySQL, and then use the MySQL program to test the MySQL configuration, of course, you have to write SQL for your own purpose.

You can!

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.