Article From:
Start with Apache.MySQL-》PHP PHPSome parameters of MySQL need to be used when compiling, and the parameters of Apache need to be used.Dead work:1、Check whether the system has its own Apache.If you can't uninstall, you need to uninstall it first.RPM-e gnome-user-shar

Then uninstall httpd.RPM-e httpd

2、GCC and GCC-c++ must be installed.(Set Yum source)Yum install GCC*

3、Close firewall, SELinuxHow to make a false statement:1)、The installation process is stopped.2)、After stopping, a page appears error or warning.How to make sure the installation is successful:Under normal circumstances, enter the installation directory to confirm whether there is a program in the directory.1、Install Apachemkdir /Apache
Dead work:1)、Compiling and installing apr, Apache Portable Runtime, mainly provides an underlying support interface library for upper-level applications that can be used across multiple operating system platforms. In earlier versions of Apache, the application itself had to be able to handle the details of a variety of specific operating system platforms and address themDifferent platforms call different processing functions. With the further development of Apache, the Apache organization decided to separate these common functions and develop them into a new project.mkdir /Apache/apr

./configure --prefix=/Apache/apr/
Note: when you execute configure, you must enter the directory of the installation package.MakeMake install2)、To compile and install apr-util, you need to install it on the basis of APR, apr-utilIt only provides more underlying support interfaces than Apr.mkdir /Apache/apr-util

./configure --prefix=/Apache/apr-util --with-apr=/Apache/apr


make install


3)、Compiling and installing PCRE is a toolkit, providing regular expression library. Many open source software needs to be used, such as Apache and PHP.mkdir /Apache/pcre

./configure --prefix=/Apache/pcre


make install

4)、Compile and install Apache../configure --prefix=/Apache/ --with-apr=/Apache/apr --with-apr-util=/Apache/apr-util --with-pcre=/Apache/pcre

5)、Can Apache test be run normally, /Apache/bin/apachectl start

7、Install MySQL1)、Installing cmake tools, like configure, is used to export all kinds of makefile files.Yum install cmake2)、The installation of bison software is a free software for automatically generating parser programs.CD/media/Packages/
yum install bison-2.4.1-5.el6.i686.rpm
rpm -q bison-2.4.1-5.el6.i686.rpm For installation, wood is available.3)、Installing the Perl language is a rich computer programming language, and installing it is because there are many libraries and components in MySQL that happen to be in the Perl language.Yum-y install perl*

Or separate installationAutoconf[root@lichihua Packages]# yum install autoconf-2.63-5.1.el6.noarch.rpm
yum install automake-1.11.1-1.2.el6.noarch.rpm
zlib*,Installing zlib function library is a function library that provides data compression. (it may be installed, use RPM -q zlibView)RPM-q zlib If installed, it will be unsafe if Yum install zlib* is not installed.
yum install flex*

yum install libtool-ltdl-devel*

4)、Install ncurses and ncurses-develThe library provides the character end processing library. Including panels and menus, it provides a set of control cursors, functions to create windows to change Foreground Background colors, and data processing operations.Yum install ncurses* So the above two have been installed successfully.5)、Create directory for MySQL installation directory and data file placementWhere do you want to install MySQL, where is the new folder?mkdir /MySQL/data

Because of MKDIR/MySQL/data
-DMYSQL_UNIX_ADDR=/apache/mysql/mysql.sockChange to -DMYSQL_UNIX_ADDR=/MySQL/mysql.sock
-DMYSQL_DATADIR=/apache/mysql/dataChange to -DMYSQL_DATADIR=/MySQL/data

Be careful:-DENABLE_DOWNLOASDSAutomatically download optional files, such as automatically downloading Google test packs.If you don't install and compile, you can't pass.Note: if there is an error in configuration, you need to delete CMakeCache..txt,Then recompile.MakeMake install8)、For the sake of safety, a special system user is required to run MySQL.Groupaddmysql groupUseradd-r -g mysql mysql The first is group second and new users.Cat/etc/passwd    
vi /etc/passwd(Can not change)mysql:x:496:501::/home/mysql:sshd:/sbin/nologin

Change the owner of the MySQL installation directory:chown -R mysql:mysql /MySQL

9)、Initializing MySQL databaseNote: you must proceed to the installation directory of MySQL./MySQL/scripts/mysql_install_db --user=mysql --datadir=/MySQL/data/

10)、Copy MySQL service startup configuration fileCP/MySQL/support-files/my-huge.cnf /etc/my.cnf
Note: if prompted/etc/my.cnFile coverage is covered.11)、mysql start/MySQL/bin/mysqld --user=mysql --datadir=/MySQL/data/ &

Note: if it is already open, use PS aux.| grep mysql Can seeClose use mysqladmin in installation directory-u root -p shutdown

/MySQL/bin/mysqladmin -u root -p shutdown

12)、Go to MySQL and test /apache/.mysql/bin/mysql -uroot -pThe default password is empty./MySQL/bin/mysql -u root -p

Note: the password is empty at the default time.13)、Change Password/MySQL/bin/mysqladmin -u root -p password '1234@abcd'

Question:1、[root@localhost mysql]# 150725 17:16:45 [ERROR] Unknown collation: 'utf8-general_ci'

Reason: do not know utf8-general_ciCheck the character set, and you can add character_set_server= under [mysqld] in my. CNF simply by revising itutf8that will do8、Install PHP1)、Install apxs (bin/ installed in the installation directory).apxsUnder the directory)2)、Install libxml library.Xml, extensible markup language, HTML has some similarities, you can customize some tags, but HTML is used for markup, XML is used to store data, used to share data between a variety of programs.The libxml library provides XMVarious ways of operation of L documents.3)、The installation of the zlib function library is a function library that provides data compression (which may have been installed).4)、Install jpeg6 to decode.Jpg and.jpegpicture./configure --prefix=/apache/jpeg --enable-shared --enable-static

--enable-sharedAnd --enable-staticParameters are libtool used to build shared libraries and static libraries.Note: the following directory must be created manually.mkdir /apache/jpeg    
mkdir /apache/jpeg/bin
mkdir /apache/jpeg/lib
mkdir /apache/jpeg/include
mkdir -p /apache/jpeg/man/man1

5)、Install libpng for decoding.pngpicture6)、With freetype installed, the FreeType library is a completely free (open source) high-quality, portable font engine that provides a unified interface to access multiple font format files, including TrueType, OpenType, Type 1, CID.CFF, Windows FON/FNT, X11 PCFWait.7)、Install gD2 for image processing.GDThe GD library is an extension of the PHP graphics library. The GD library provides a series of APIs for processing pictures. Using the GD library, you can process pictures or generate pictures. GD libraries on websites are often used to generate thumbnails, to watermark images, to generate Chinese character validation codes, or to create websites.Data generation report, etc../configure --prefix=/apache/gd2 --with-jpeg=/apache/jpeg --with-freetype=/apache/freetype --with-png=/apache/libpng --with-zlib=/apache/zlib

Be careful:1、gdThe library handles the jpeg\ font \png file, indicating the location of the application.2、pngMistakes, solutions. (if there is no solution, there will be problems.Before installing GD2)VI gd_png.c
hold#include "png.h" Modified to #include "/apache/libpng/include/png.h".

8)、Because PHP 5.4The version of the GD library will have problems and manual modifications. (after installation of GD2)VI/apache/gd2/incude/gd_io.h
In typedef struct gdIOCt{Void (*data);#Join this sentence

9)、The installation of libmcrypt library is an encryption algorithm extension library.10)、Installing curl is a tool that uses URL syntax to transfer files and data. It supports many protocols, such as HTTP, FTP, TELNET, and so on.11)、Compile PHP./configure --prefix=/apache/php/ --with-config-file-path=/apache/php/etc --with-apxs2=/apache/bin/apxs --with-mysql=/apache/mysql/ --with-libxml-dir=/apache/libxml/ --with-jpeg-dir=/apache/jpeg/ --with-png-dir=/apache/libpng/ --with-freetype-dir=/apache/freetype/ --with-gd=/apache/gd2/ --with-mcrypt=/apache/libmcrypt/ --with-mysqli=/apache/mysql/bin/mysql_config --enable-soap --enable-mbstring=all --enable-sockets --with-pdo-mysql=/apache/mysql/ --without-pear --with-curl=/apache/curl/

Be careful:1、/apache/php/etcYou need to create it yourself.2、If promptSorry, I cannot run apxs. Possible reasons follow:

1. Perl is not installed
2. apxs was not found. Try to pass the path using --with-apxs2=/path/to/apxs
3. Apache was not built using --enable-so (the apxs usage page is displayed)

The output of /apache/bin/apxs follows:
./configure: line 8421: /apache/bin/apxs: No such file or directory
configure: error: Aborting
Indicates that no Perl has been installed, or no directory of apxs has been found. It has been installed when Apache is installed.11)、Create /apache/php/etcDirectory, placing configuration files12)、Copy the initial configuration file.13)、Modify the Apache configuration file so that Apache can recognize the PHP file.14)、Restart Apache service


Link of this Article: Lamp source installation

Leave a Reply

Your email address will not be published. Required fields are marked *