热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

[Ubuntu]如何在Ubuntu11.04将PHP5.3降级到PHP5.2

众所周知,Ubuntu11.04使用sudoapt-get安装好的php版本是5.3.5,很多网站都是不兼容的,所以要找个办法降级。还好借助google,把问题都搞掂了~创建一个php

众所周知,Ubuntu11.04使用sudo apt-get 安装好的php版本是5.3.5,很多网站都是不兼容的,所以要找个办法降级。

 

还好借助google,把问题都搞掂了~

 

创建一个php_version.sh,然后输入下面内容。

# !/bin/bash
#
 by Ruben Barkow (rubo77) http://www.entikey.z11.de/

#  Originally Posted by Bachstelze http://ubuntuforums.org/showthread.php?p=9080474#post9080474
#
 OK, here's how to do the Apt magic to get PHP packages from the karmic repositories:

echo 
" Am I root?  "
if  [  " $(whoami &2>/dev/null) "   !=   " root "  ]  &&  [  " $(id -un &2>/dev/null) "   !=   " root "  ] ; then
echo 
"  NO!

Error: You must be root to run this script.
Enter
sudo su
"
exit 
1
fi
echo 
"  OK " ;


# install aptitude before, if you don`t have it:
apt - get install aptitude
#  or if you prefer apt-get use:
#
 alias aptitude='apt-get'

#  finish all apt-problems:
aptitude update
aptitude 
-f  install
# apt-get -f install

#  remove all your existing PHP packages. You can list them with dpkg -l| grep php
PHPLIST =$ ( for  i  in   $ (dpkg  - |  grep php | awk '{ print  $2  }' );  do  echo  $i ; done)
echo these pachets will be removed: 
$PHPLIST  
#  you need not to purge, if you have upgraded from karmic:
aptitude remove  $PHPLIST
#  on a fresh install, you need purge:
#
 aptitude remove --purge $PHPLIST


# Create a file each in /etc/apt/preferences.d like this (call it for example /etc/apt/preferences.d/php5_2);
#
#
Package: php5
#
Pin: release a=karmic
#
Pin-Priority: 991
#
#
The big problem is that wildcards don't work, so you will need one such stanza for each PHP package you want to pull from karmic:

echo ''
>/ etc / apt / preferences.d / php5_2
for  i  in   $PHPLIST  ;  do  echo  " Package: $i
Pin: release a=karmic
Pin-Priority: 991
" >>/ etc / apt / preferences.d / php5_2; done

#  duplicate your existing sources.list replacing lucid with karmic and save it in sources.list.d:
#
sed s/lucid/karmic/g /etc/apt/sources.list | sudo tee /etc/apt/sources.list.d/karmic.list

#  better exactly only the needed sources, cause otherwise you can get a cachsize problem:
echo  " # needed sources vor php5.2:
deb http://de.archive.ubuntu.com/ubuntu/ karmic main restricted
deb-src http://de.archive.ubuntu.com/ubuntu/ karmic main restricted

deb http://de.archive.ubuntu.com/ubuntu/ karmic-updates main restricted
deb-src http://de.archive.ubuntu.com/ubuntu/ karmic-updates main restricted

deb http://de.archive.ubuntu.com/ubuntu/ karmic universe
deb-src http://de.archive.ubuntu.com/ubuntu/ karmic universe
deb http://de.archive.ubuntu.com/ubuntu/ karmic-updates universe
deb-src http://de.archive.ubuntu.com/ubuntu/ karmic-updates universe

deb http://de.archive.ubuntu.com/ubuntu/ karmic multiverse
deb-src http://de.archive.ubuntu.com/ubuntu/ karmic multiverse
deb http://de.archive.ubuntu.com/ubuntu/ karmic-updates multiverse
deb-src http://de.archive.ubuntu.com/ubuntu/ karmic-updates multiverse

deb http://security.ubuntu.com/ubuntu karmic-security main restricted
deb-src http://security.ubuntu.com/ubuntu karmic-security main restricted
deb http://security.ubuntu.com/ubuntu karmic-security universe
deb-src http://security.ubuntu.com/ubuntu karmic-security universe
deb http://security.ubuntu.com/ubuntu karmic-security multiverse
deb-src http://security.ubuntu.com/ubuntu karmic-security multiverse
"   >>   / etc / apt / sources.list.d / karmic.list

aptitude update

apache2ctl restart

echo install new from karmic:
aptitude 
- t karmic install  $PHPLIST

#  at the end retry the modul libapache2-mod-php5 in case it didn't work the first time:
aptitude  - t karmic install libapache2 - mod - php5

apache2ctl restart

 

授权可运行:

chmod  + x php_version.sh

运行:

sudo . / php_version.sh

 

过一段时间等它运行完了,运行一下

 

 

搞掂!

Have fun with Ubuntu! 

 

 

 

 

 


推荐阅读
  • Iamtryingtomakeaclassthatwillreadatextfileofnamesintoanarray,thenreturnthatarra ... [详细]
  • Centos7.6安装Gitlab教程及注意事项
    本文介绍了在Centos7.6系统下安装Gitlab的详细教程,并提供了一些注意事项。教程包括查看系统版本、安装必要的软件包、配置防火墙等步骤。同时,还强调了使用阿里云服务器时的特殊配置需求,以及建议至少4GB的可用RAM来运行GitLab。 ... [详细]
  • 关键词:Golang, Cookie, 跟踪位置, net/http/cookiejar, package main, golang.org/x/net/publicsuffix, io/ioutil, log, net/http, net/http/cookiejar ... [详细]
  • Android开发实现的计时器功能示例
    本文分享了Android开发实现的计时器功能示例,包括效果图、布局和按钮的使用。通过使用Chronometer控件,可以实现计时器功能。该示例适用于Android平台,供开发者参考。 ... [详细]
  • 使用nodejs爬取b站番剧数据,计算最佳追番推荐
    本文介绍了如何使用nodejs爬取b站番剧数据,并通过计算得出最佳追番推荐。通过调用相关接口获取番剧数据和评分数据,以及使用相应的算法进行计算。该方法可以帮助用户找到适合自己的番剧进行观看。 ... [详细]
  • 在Docker中,将主机目录挂载到容器中作为volume使用时,常常会遇到文件权限问题。这是因为容器内外的UID不同所导致的。本文介绍了解决这个问题的方法,包括使用gosu和suexec工具以及在Dockerfile中配置volume的权限。通过这些方法,可以避免在使用Docker时出现无写权限的情况。 ... [详细]
  • 本文介绍了使用kotlin实现动画效果的方法,包括上下移动、放大缩小、旋转等功能。通过代码示例演示了如何使用ObjectAnimator和AnimatorSet来实现动画效果,并提供了实现抖动效果的代码。同时还介绍了如何使用translationY和translationX来实现上下和左右移动的效果。最后还提供了一个anim_small.xml文件的代码示例,可以用来实现放大缩小的效果。 ... [详细]
  • 如何去除Win7快捷方式的箭头
    本文介绍了如何去除Win7快捷方式的箭头的方法,通过生成一个透明的ico图标并将其命名为Empty.ico,将图标复制到windows目录下,并导入注册表,即可去除箭头。这样做可以改善默认快捷方式的外观,提升桌面整洁度。 ... [详细]
  • 阿,里,云,物,联网,net,core,客户端,czgl,aliiotclient, ... [详细]
  • Windows下配置PHP5.6的方法及注意事项
    本文介绍了在Windows系统下配置PHP5.6的步骤及注意事项,包括下载PHP5.6、解压并配置IIS、添加模块映射、测试等。同时提供了一些常见问题的解决方法,如下载缺失的msvcr110.dll文件等。通过本文的指导,读者可以轻松地在Windows系统下配置PHP5.6,并解决一些常见的配置问题。 ... [详细]
  • 本文介绍了Perl的测试框架Test::Base,它是一个数据驱动的测试框架,可以自动进行单元测试,省去手工编写测试程序的麻烦。与Test::More完全兼容,使用方法简单。以plural函数为例,展示了Test::Base的使用方法。 ... [详细]
  • Android系统移植与调试之如何修改Android设备状态条上音量加减键在横竖屏切换的时候的显示于隐藏
    本文介绍了如何修改Android设备状态条上音量加减键在横竖屏切换时的显示与隐藏。通过修改系统文件system_bar.xml实现了该功能,并分享了解决思路和经验。 ... [详细]
  • [大整数乘法] java代码实现
    本文介绍了使用java代码实现大整数乘法的过程,同时也涉及到大整数加法和大整数减法的计算方法。通过分治算法来提高计算效率,并对算法的时间复杂度进行了研究。详细代码实现请参考文章链接。 ... [详细]
  • 本文介绍了在多平台下进行条件编译的必要性,以及具体的实现方法。通过示例代码展示了如何使用条件编译来实现不同平台的功能。最后总结了只要接口相同,不同平台下的编译运行结果也会相同。 ... [详细]
  • Ubuntu安装常用软件详细步骤
    目录1.GoogleChrome浏览器2.搜狗拼音输入法3.Pycharm4.Clion5.其他软件1.GoogleChrome浏览器通过直接下载安装GoogleChro ... [详细]
author-avatar
小怡的宝_594
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有