Compiling and installing PHP

Source: Internet
Author: User

You need to install the software when compiling and installing PHP

Yum install-y zlib libxml libjpeg freetype libpng gd Curl libiconv zlib-devel libxml2-devel libjpeg-devel freetype-devel Libpng-devel Gd-devel Curl-devel

After installation, you need to compile and install Libiconv-1.14.tar here version with 1.14 for the list yum not installed

./configure--prefix=/usr/local/libiconv/

Make

Make install


Install PHP After installing the above modules.

./configure \
--prefix=/application/php5.3.27 \
--WITH-APXS2=/APPLICATION/APACHE/BIN/APXS \ Note: Consistent with Apache's installation directory
--WITH-MYSQL=/APPLICATION/MYSQL \ Note: Consistent with MySQL installation directory
--WITH-XMLRPC \
--WITH-OPENSSL \
--with-zlib \
--with-freetype-dir \
--WITH-GD \
--with-jpeg-dir \
--with-png-dir \
--WITH-ICONV=/USR/LOCAL/LIBICONV \ Note the same as the installation directory of the previously compiled installation Libiconv
--enable-short-tags \
--enable-sockets \
--enable-zend-multibyte \
--ENABLE-SOAP \
--enable-mbstring \
--enable-static \
--ENABLE-GD-NATIVE-TTF \
--with-curl \
--with-xsl \
--ENABLE-FTP \
--with-libxml-dir


Note: Since the PHP I am installing is for lamp service, PHP's corresponding Apache directory and MySQL directory must match. In the./configure, you may encounter errors, mostly due to the lack of corresponding modules and error, yum installation is good.

The last three lines after installation are as follows:

/usr/local/tools/php-5.3.27/build/shtool install-c Ext/phar/phar.phar/application/php5.3.27/bin
Ln-s-f/application/php5.3.27/bin/phar.phar/application/php5.3.27/bin/phar
Installing PDO headers:/application/php5.3.27/include/php/ext/pdo/


At this point, you can check to see if the PHP module is inserted in Apache

[Email protected] application]# ll/application/apache/modules/
-rw-r--r--1 root root 9115 05-03 03:54 httpd.exp
-rwxr-xr-x 1 root root 22991145 05-04 11:24 libphp5.so
[[email protected] application]# grep libphp5/application/apache/conf/httpd.conf
LoadModule Php5_module modules/libphp5.so


Copy the main configuration file of PHP to the corresponding file path:

Cp/usr/local/tools/php-5.3.27/php.ini-production/application/php/lib/php.ini


[Email protected] application]# ll/usr/local/tools/php-5.3.27/php.ini*
-rw-r--r--1 101 Ecryptfs 69606 2013-07-11/usr/local/tools/php-5.3.27/php.ini-development
-rw-r--r--1 101 Ecryptfs 69627 2013-07-11/usr/local/tools/php-5.3.27/php.ini-production

This directory has two configuration files, development is a development version of the configuration file, production is the production environment required configuration files, two profiles are the difference is development configuration file opened a lot of error logs, easy for developers to view, The development configuration file closes these error logs, does not allow users to view these error logs, to prevent hackers.

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.