Build Lamp architecture-3, manually compile and install PHP

Source: Internet
Author: User
Tags gettext openssl

PHP, a nested abbreviated name, is an abbreviation for the English Super Text preprocessing language (Php:hypertext preprocessor). PHP is an HTML embedded language, PHP and Microsoft's ASP quite a bit similar, is a server-side implementation of embedded HTML document scripting language, language style has similar to C language, is now widely used by many web site programmers.

This time let's complete the compilation and installation of PHP, and let Apache support PHP.

    • First we use the Yum warehouse to install some associated programs:

      Yum install \
      Libjpeg-devel \
      Libpng-devel \
      Freetype-devel \
      Zlib-devel \
      Gettext-devel \
      Libxpm-devel \
      Libxml2-devel \
      Fontconfig-devel \
      Openssl-devel \
      Bzip2-devel

    • Install the GD library to process and generate images:
      tar xzvf /opt/lamp/gd-2.0.35.tar.gz -C /opt    //解压软件包cd /opt/gd/2.0.35    //移动到目录中./configure --prefix=/usr/local/gd    //配置make && make install    //编译安装
    • Install PHP, enter the configuration text into the PHP directory, and compile the installation:

Tar xjvf/opt/lamp/php-5.4.5.tar.bz2-c/opt//Unpacking Package
CD/OPT/PHP-5.4.5///Move to PHP directory
#输入配置文本:
./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 during make--ignore----

vi /usr/local/gd/include/gd_io.hvoid (*gd_free) (struct gdIOCtx *);void (*data); //添加//}gdIOCtx;cp php.ini-production /etc/php.ini //优化调整PHP//
    • Below, let's get Apache to support PHP:

      vim/usr/local/apache/conf/httpd.conf//Enter Edit httpd config file

      Find AddType application/x-gzip gz. tgz below to add the following:
      AddType application/x-httpd-php. php
      AddType Application/x-httpd-php-source. Phps

      LoadModule php5_module modules/libphp5.so//Check for presence

      DirectoryIndex index.html index.php (ADD)//adjust home file settings

    • At this point we can restart the HTTPD service and perform a PHP test:
      #重启服务service httpd restart#创建一个php测试页vim /usr/local/apache/htdocs/index.php#添加以下内容<?phpphpinfo();?>
    • Use a different machine to access the test PHP page:

Build Lamp architecture-3, manually compile and install 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.