Php compilation and installation, cgi startup, and memcache extension compilation and installation.

Source: Internet
Author: User

Install the required dependency Library first (parameters-y: apt-get command parameters detailed http://hi.baidu.com/usen68/item/942891e5de324f0f8d3ea885 ):

 1 sudo apt-get -y install autoconf && \ 2 sudo apt-get -y install libxml2-dev && \ 3 sudo apt-get -y install bzip2 && \ 4 sudo apt-get -y install libcurl3-openssl-dev && \ 5 sudo apt-get -y install libcurl4-gnutls-dev && \ 6 sudo apt-get -y install libjpeg-dev && \ 7 sudo apt-get -y install libpng-dev && \ 8 sudo apt-get -y install libxpm-dev && \ 9 sudo apt-get -y install libfreetype6-dev && \10 sudo apt-get -y install libt1-dev && \11 sudo apt-get -y install libmcrypt-dev && \12 sudo apt-get -y install libmysql++-dev && \13 sudo apt-get -y install libxslt1-dev && \14 sudo apt-get -y install libbz2-dev

Soft link library file:

cd /usr/lib && \ln -s /usr/lib/x86_64-linux-gnu/libXpm.so . && \ln -s /usr/lib/x86_64-linux-gnu/libXpm.a . && \ln -s /usr/lib/x86_64-linux-gnu/libXpm.so.4 . && \ln -s /usr/lib/x86_64-linux-gnu/libXpm.so.4.11.0 . && \echo 'successful!'

Download the latest php source code, compile and install it:

cd /opt && \sudo mkdir src && \cd src && \sudo wget http://us1.php.net/distributions/php-5.4.14.tar.gz && \sudo tar zxvf php-5.4.14.tar.gz && \cd php-5.4.14 && \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:

Key parameters:

-- Prefix =/usr/local/php

Specify the php installation directory

 

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

Specify the php. ini location

 

-- With-MySQL =/usr/local/mysql (not recommended for new php versions)

Mysql installation directory, which supports mysql

-- With-mysqli =/usr/local/mysql/bin/mysql_config (not recommended for new php versions)

Mysqli extension technology can not only call the MySQL stored procedure and process MySQL transactions, but also make database access more stable.

 

An explanation of mysqlnd: http://baike.baidu.com/view/2630684.htm? Fr = aladdin

 

If there is no problem, execute the last step of compilation and installation:

Sudo make & sudo make install

 

Start the cgi of php (pay attention to configuring the startup account and group for the php-fgm.conf, otherwise an error is reported, 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

Cgi performance optimization: http://hi.baidu.com/cpu686/item/84fbb7f6bcb4f8ce521c2669

 

Add php memcache support (Compilation and installation)

 

Download the latest extended source http://pecl.php.net/package/memcache

1 tar -zxvf memcache-2.2.3.tgz2 cd memcache-2.2.3/3 sudo /usr/local/php526/bin/phpize4 sudo ./configure –with-php-config=/usr/local/php/bin/php-config5 make6 make install7 cd ../

Go to php. ini and add a line after extension_dir = "./".

Extension = "memcache. so ";

You can.

 

Then

Sudo netstat-anp | grep "php"

Kill the phpcgi process and restart cgi sudo/usr/local/php/sbin/php-fpm-c/usr/local/php/etc/php. ini-y/usr/local/php/etc/php-fpm.conf

 

This is the end of today's exercises... I have to say that the things on the server are still compiled and installed well and can be controlled globally.

 

 

 

 

 

 

 

 

 

 

 

 

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.