Lamp architecture Deployment--three. Compiling and installing PHP

Source: Internet
Author: User
Tags gettext

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
    1. 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
    1. 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

    1. Unzip GD file to/opt/
      tar xjvf php-5.4.5.tar.bz2 -C /opt
    2. 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

    1. 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

    1. Restarting the HTTPD service
      service httpd restart
    2. 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

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.