Lamp Component Introduction
- Lamp refers to Linux, Apache,mysql and PHP abbreviation, many production environments are used lamp architecture, in the Network application and development environment, lamp combination is very good, their combination provides a powerful function.
- Linux, as the underlying operating system, provides a flexible and secure application platform, which guarantees the stable operation of other components.
- Apache, as a Web server, provides a powerful, stable and supportive web platform;
- MySQL is also a good database software;
- PHP is a development scripting language, can be embedded in HTML, for Web development;
Preparatory work
Operating system: RHEL 6.5
Related software package: Baidu Network disk Password: Bty7
The native system image is mounted to/mnt/cdrom/(used when installing a dependent package)
Third, PHP installation
- First install GD Library and GD Library Association program//used to process and generate pictures//
yum install libjpeg-devel libpng-devel freetype-devel zlib-devel gettext-devel libXpm-devel libxml2-devel fontconfig-devel openssl-devel bzip2-devel -y
- Unzip GD file to/opt/
tar xzvf gd-2.0.35.tar.gz -C /opt
3. Configure, compile, and install GD
#进入gd目录下
cd/opt/gd/2.0.35
#配置
./configure--prefix=/usr/local/gd
#编译并安装
Make & & Make install
- Unzip GD file to/opt/
tar xjvf php-5.4.5.tar.bz2 -C /opt
- Configuring, compiling, and installing PHP
Go to the PHP directory
cd/opt/php-5.4.5/
#配置
./configure \
--prefix=/usr/local/php \
--WITH-APXS2=/USR/LOCAL/APACHE/BIN/APXS \
--WITH-GD \
--with-mysql=/usr/local/mysql \
--WITH-CONFIG-FILE-PATH=/ETC \
--enable-sqlite-utf8 \
--with-zlib-dir \
--with-libxml-dir \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--WITH-TTF \
--with-iconv \
--WITH-OPENSSL \
--with-gettext \
--enable-mbstring \
--ENABLE-GD-NATIVE-TTF \
--enable-gd-jis-conv \
--enable-static \
--enable-zend-multibyte \
--enable-inline-optimization \
--enable-sockets \
--ENABLE-SOAP \
--ENABLE-FTP \
--disable-ipv6
#编译并安装
Make && make install
Resolve errors in the make process (this step is used without errors when making error occurs, skip)
Vi/usr/local/gd/include/gd_io.h
void (gd_free) (struct gdioctx );
void (*data); Add//
}
Gdioctx;
CP Php.ini-production/etc/php.ini #优化调整PHP
- Configure the Apache service to allow it to support PHP
vim /usr/local/apache/conf/httpd.conf
#找到 AddType application/x-gzip. gz. tgz Add the following below
AddType application/x-httpd-php. php
AddType Application/x-httpd-php-source. Phps
#检查是否存在, no query to 5th step reinstall
LoadModule php5_module modules/libphp5.so//must exist before it can be
#添加index. php
DirectoryIndex index.php index.html//Adjust home file settings
- Restarting the HTTPD service
service httpd restart
- Create a PHP test page
#进入网站目录下
cd/usr/local/apache/htdocs/
#创建index. php files
Vim index.php
Add the following to the index.php file
<?php
Phpinfo ();
?>
Test
Check the contents of the PHP test page, for example, the PHP is already installed, and Apache already supports PHP.
Lamp architecture Deployment--three. Compiling and installing PHP