On-Line Server PHP version compilation installation upgrade full record

Source: Internet
Author: User
Tags gpg install redis

1. Rename the original PHP

CD/USR/LOCAL/BIN/MV PHP php.2.9

2. Installation dependencies

Yum install gcc gcc-c++ libxml2 libxml2-devel autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel
   zlib zlib-devel glibc glibc-devel glib2 glib2-devel

Error, CentOS version is too old, 5.5,yum source is not available

3. Replace the Yum Source, refer to Http://www.baddb.com/511.html

Handle Vi/etc/yum.repos.d/centos-base.repo by modifying the source address in the Centos-base.repo file

Change the original BaseURL to New, and eventually the content to:

# centos-base.repo## The mirror system uses the connecting IP address of the client and the# update status of each mirror To pick mirrors that is updated to and# geographically close to the client. You should use this for CentOS updates# unless is manually picking other mirrors.## If the mirrorlist= does For your, as a fall back can try the# remarked off baseurl= line instead.##[base]name=centos-$releasever-base#mirrorl ist=http://mirrorlist.centos.org/?release= $releasever &arch= $basearch &repo=os#baseurl=http:// mirror.centos.org/centos/$releasever/os/$basearch/baseurl=http://vault.centos.org/5.11/os/$basearch/gpgcheck= 1gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-5 #released updates[updates]name=centos-$releasever-updates# mirrorlist=http://mirrorlist.centos.org/?release= $releasever &arch= $basearch &repo=updates#baseurl=http ://mirror.centos.org/centos/$releasever/updates/$basearch/baseurl=http://vault.centos.org/5.11/updates/$basearch/Gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-5#additional packages that could be useful[extras]name= centos-$releasever-extras#mirrorlist=http://mirrorlist.centos.org/?release= $releasever &arch= $basearch & repo=extras#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/baseurl=http://vault.centos.org/5.11/extras/$basearch/Gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-5#additional packages that extend functionality of Existing packages[centosplus]name=centos-$releasever-plus#mirrorlist=http://mirrorlist.centos.org/?release=$ Releasever&arch= $basearch &repo=centosplus#baseurl=http://mirror.centos.org/centos/$releasever/ centosplus/$basearch/baseurl=http://vault.centos.org/5.11/centosplus/$basearch/Gpgcheck=1enabled=0gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-5#contrib-packages by CentOS Users[contrib] name=centos-$releasever-contrib#mirrorlist=http://mirrorlist.centos.org/?release= $releasever &arch=$ basearch&repo=contrib#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/baseurl=http://vault.centos.org/5.11/contrib/$basearch/Gpgcheck=1enabled=0gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-5

4. Continue to install dependencies

Yum install gcc gcc-c++ libxml2 libxml2-devel autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel
   zlib zlib-devel glibc glibc-devel glib2 glib2-develyum install-y libc-client-devel

5. Go to the path where you put the PHP installation package, mine is under TMP

Cd/tmp
TAR-ZXVF php-5.4.13.tar.gz
CD./php-5.4.13
Compile command

Installation
Make && make install
CP./php-5.4.13/libs/php.ini/usr/local/php/lib/php.ini
Vi/usr/local/php/lib/php.ini
Modify the time zone to
Date.timezone=prc
Cd/tmp

6. Modify Httpd.conf

The loaded module is modified to
#LoadModule php5_module/usr/local/php5/lib/libphp5.so
LoadModule php5_module/usr/local/php/lib/libphp5.so

7. View the expansion status

View the expansion of PHP installation/usr/local/php/bin/php-m

8. Found no Memcache,memcached,redis extension, install extension

/usr/local/php/bin/pecl Install Memcache
/usr/local/php/bin/pecl Install memcached-2.2.0

9. Installation memcached extension failed, missing libmemcached, processing method (reference: https://www.cnblogs.com/dyllove98/archive/2014/11/27/4126840.html):

wget  https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz

CD./libmemcached-1.0.18
Compiling the installation
./configure--prefix=/usr/local/libmemcached--with-memcached //Note:--with-memcached This option must be added
Make && make install

10. Installing the memcached Extension

Cd/tmp
wget http://pecl.php.net/get/memcached-2.2.0.tgz
TAR-ZXVF memcached-2.2.0.tgz
CD./memcached-2.2.0
Enter the directory after unpacking, first use the phpize command to generate a configure file
/usr/local/php/bin/phpize//This command will compile and install PHP in the installation directory under the Bin directory, but in the Yum installation of PHP need to install a package called Php-devel will have (I have been a hole here ...) )
./configure--with-php-config=/usr/local/php/bin/php-config--with-libmemcached-dir=/usr/local/libmemcached// Php-config here if you don't know where it is, you can find it with the Find/-name php-config command.
Make && make install

11. Installing the Redis Extension

/usr/local/php/bin/pecl Install Redis

12. Add Extensions to PHP.ini

Vi/usr/local/php/lib/php.ini
Join
Extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525"
Extension = "memcache.so"
Extension = "memcached.so"
Extension = "redis.so"

13. Restart Apache

Service httpd restart//or find Apachectl restart

Online server PHP version compilation installation upgrade full record

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.