Install PHP5.2 in Ubuntu10.04

Source: Internet
Author: User
The reason is that Ubuntu10.04's PHP version is 5.3, and there are a bunch of compatibility problems. To replace it with stable 5.2, the method here is to install the PHP5.2 package of 9.10. For other methods, refer to the bottom link. Operate sudogedit/etc/apt/sources. list. d/karmic. listdebhttp: // archive.ubuntu.com/ubuntu/karmicmainrestricteduniverse

Cause
The PHP version of Ubuntu 10.04 is 5.3, and there are a bunch of compatibility issues. You need to switch back to the stable 5.2. The method here is to install the 9.10 PHP 5.2 package. For other methods, refer to the bottom link.

Operation
Sudo gedit/etc/apt/sources. list. d/karmic. list


Deb http://archive.ubuntu.com/ubuntu/ karmic main restricted universe multiverse
Deb-src http://archive.ubuntu.com/ubuntu/ karmic main restricted universe multiverse
Deb http://archive.ubuntu.com/ubuntu/ karmic-updates main restricted universe multiverse
Deb-src http://archive.ubuntu.com/ubuntu/ karmic-updates main restricted universe multiverse
Deb http://security.ubuntu.com/ubuntu karmic-security main restricted universe multiverse
Deb http://www.linuxidc.com/Linux/2011-02/32411.htm
The deb-src http://security.ubuntu.com/ubuntu karmic-security main restricted universe multiverse

Sudo gedit/etc/apt/preferences. d/php

Package: libapache2-mod-php5
Pin: version 5.2.10 *
Pin-Priority: 991

Package: libapache2-mod-php5filter
Pin: version 5.2.10 *
Pin-Priority: 991

Package: php-pear
Pin: version 5.2.10 *
Pin-Priority: 991

Package: php5
Pin: version 5.2.10 *
Pin-Priority: 991

Package: php5-cgi
Pin: version 5.2.10 *
Pin-Priority: 991

Package: php5-cli
Pin: version 5.2.10 *
Pin-Priority: 991

Package: php5-common
Pin: version 5.2.10 *
Pin-Priority: 991

Package: php5-curl
Pin: version 5.2.10 *
Pin-Priority: 991

Package: php5-dbg
Pin: version 5.2.10 *
Pin-Priority: 991

Package: php5-dev
Pin: version 5.2.10 *
Pin-Priority: 991

Package: php5-gd
Pin: version 5.2.10 *
Pin-Priority: 991

Package: php5-gmp
Pin: version 5.2.10 *
Pin-Priority: 991

Package: php5-ldap
Pin: version 5.2.10 *
Pin-Priority: 991

Package: php5-mhash
Pin: version 5.2.10 *
Pin-Priority: 991

Package: php5-mysql
Pin: version 5.2.10 *
Pin-Priority: 991

Package: php5-odbc
Pin: version 5.2.10 *
Pin-Priority: 991

Package: php5-pgsql
Pin: version 5.2.10 *
Pin-Priority: 991

Package: php5-pspell
Pin: version 5.2.10 *
Pin-Priority: 991

Package: php5-recode
Pin: version 5.2.10 *
Pin-Priority: 991

Package: php5-snmp
Pin: version 5.2.10 *
Pin-Priority: 991

Package: php5-sqlite
Pin: version 5.2.10 *
Pin-Priority: 991

Package: php5-sybase
Pin: version 5.2.10 *
Pin-Priority: 991

Package: php5-tidy
Pin: version 5.2.10 *
Pin-Priority: 991

Package: php5-xmlrpc
Pin: version 5.2.10 *
Pin-Priority: 991

Package: php5-xsl
Pin: version 5.2.10 *
Pin-Priority: 991

Create a script file php2.5

#! /Bin/sh-e
# Script to install PHP 5.2 from 9.10 on 10.04
# And pin it so it does not get updated
# Package available and may be installed later
PKGSAVAILABLE = "'Aptitude search-F' % P' php5 'php-pear"
PKGSINSTALLED = 'dpkg-l | grep php | awk '{print $2 }''
Aptitude remove $ PKGSINSTALLED
# Disable duplicate entries
Grep 'ubuntu. com'/etc/apt/sources. list | sed s/lucid/karmic/g> tee/etc/apt/sources. list. d/karmic. list
For PACKAGE in $ PKGSAVAILABLE
Do
# Aptitude seems to use/etc/apt/preferences but not/etc/apt/preferences. d /*
# Cf https://bugs.launchpad.net/ubuntu/+source/aptitude/+bug/508545
If egrep-q "Package :? $ {PACKAGE} $ "/etc/apt/preferences
Then
Echo "$ PACKAGE already in preference"
Else
Echo "\ nPackage :$ {PACKAGE} \ nPin: release a = karmic \ nPin-Priority: 991">/etc/apt/preferences
Fi
Done
Aptitude update
Aptitude install $ PKGSINSTALLED
Change to executable, run with root Account

Sudo chmod + x php2.5./php2.5

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.