PHP compilation installation, CGI boot, and memcache extension compilation installation.

Source: Internet
Author: User
Tags php source code

First install the necessary dependent libraries (Parameters-y:apt-get command parameters in detail http://hi.baidu.com/usen68/item/942891e5de324f0f8d3ea885):

1sudo apt-Get-Y install autoconf && 2sudo apt-Get-Y Install Libxml2-dev && 3sudo apt-Get-Y Install bzip2 && 4sudo apt-Get-Y Install Libcurl3-openssl-dev && 5sudo apt-Get-Y Install Libcurl4-gnutls-dev && 6sudo apt-Get-Y Install Libjpeg-dev && 7sudo apt-Get-Y Install Libpng-dev && 8sudo apt-Get-Y Install Libxpm-dev && 9sudo apt-Get-Y Install Libfreetype6-dev && Tensudo apt-Get-Y Install Libt1-dev &&  Onesudo apt-Get-Y Install Libmcrypt-dev &&  Asudo apt-Get-Y Install Libmysql++-dev &&  -sudo apt-Get-Y Install Libxslt1-dev &&  -sudo apt-Get-Y Install Libbz2-dev

Soft link library file:

Cd/usr/lib &&-s/usr/lib/x86_64-linux-gnu/libxpm.so. &&-S/USR/LIB/X86_64-LINUX-GNU/LIBXPM.A. &&-s/usr/lib/x86_64-linux-gnu/libxpm.so. 4 . &&-s/usr/lib/x86_64-linux-gnu/libxpm.so. 4.11. 0 . &&'successful! '

Download the latest PHP source code, compile and install:

Cd/opt && sudo mkdirSRC &&CD src&& sudo wgethttp//us1.php.net/distributions/php-5.4.14.tar.gz && \sudo TarZXVF php-5.4. -.Tar. GZ &&cd PHP-5.4. -&& sudo./Configure--prefix=/usr/local/PHP--with-mysql=Mysqlnd--with-mysqli=Mysqlnd--with-pdo-mysql=Mysqlnd--with-config-file-path=/usr/local/php/etc--with-zlib--with-Curl--with-curlwrappers--with-MCrypt--with-GD--with-OpenSSL--with-Mhash--with-Xmlrpc--with-jpeg-dir --with-png-dir --with-xpm-dir --with-freetype-dir --with-zlib-dir --enable-shared--enable-FPM--enable-XML--disable-rpath--enable-safe-Mode--enable-Bcmath--enable-Shmop--enable-Sysvsem--enable-inline-optimization--enable-Mbregex--enable-mbstring--enable-gd-native-TTF--enable-Pcntl--enable-Sockets--enable-Zip --enable-soap

! Note

which key parameters:

--prefix=/usr/local/php

Specify the PHP installation directory

--with-config-file-path=/usr/local/php/etc

Specify PHP.ini location

--with-mysql=/usr/local/mysql (new PHP not recommended)

MySQL installation directory, support for MySQL

--with-mysqli=/usr/local/mysql/bin/mysql_config (new PHP not recommended)

MYSQLI extension technology can not only invoke MySQL's stored procedures, handle MySQL transactions, but also make access to the database work more stable.

Explanation of Mysqlnd: Http://baike.baidu.com/view/2630684.htm?fr=aladdin

No problem, just perform the final step of compiling the installation:

sudo make && sudo make install

Start PHP CGI (note Configure php-fgm.conf startup account and group, otherwise error, details: http://www.cnblogs.com/argb/p/3604340.html)

Sudo/usr/local/php/sbin/php-fpm-c/usr/local/php/etc/php.ini-y/usr/local/php/etc/php-fpm.conf

Performance optimizations for CGI: http://hi.baidu.com/cpu686/item/84fbb7f6bcb4f8ce521c2669

Add PHP memcache Support (compile and install)

Download the latest extension source Http://pecl.php.net/package/memcache

 1  tar -ZXVF Memcache-2.2 . 3  .tgz  2  cd Memcache-3 /3  sudo/usr/local/php526/bin/ phpize  config  5  make  Span style= "Color:rgb (0, 128, 128); >6  make  install  Span style= "Color:rgb (0, 128, 128); >7  CD. /

Again to php.ini inside, again extension_dir = "./" After adding a row

Extension= "memcache.so";

Can

And then

sudo netstat-anp | grep "PHP"

Kill phpcgi Process New start CGI sudo/usr/local/php/sbin/php-fpm-c/usr/local/php/etc/php.ini-y/usr/local/php/etc/ Php-fpm.conf

This concludes today's exercise ... Have to say that the server on the thing or compile and install the good, can be the overall control.

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.