个人工具
登录
查看“PHP5.2”的源代码 - Ubuntu中文
页面
讨论
查看源代码
历史
搜索
导航
首页
最近更改
随机页面
页面分类
帮助
编辑
编辑指南
沙盒
新闻动态
字词处理
工具
链入页面
相关更改
特殊页面
页面信息
查看“PHP5.2”的源代码
来自Ubuntu中文
←
PHP5.2
跳转至:
导航
,
搜索
因为以下原因,你没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
==原因== Ubuntu 10.04的PHP版本是5.3,兼容性问题一堆,要换回稳定的5.2,这里的方法是安装9.10的PHP 5.2包,其他方法参考底部链接。 ==操作== <pre>sudo gedit /etc/apt/sources.list.d/karmic.list</pre> <pre>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-src http://security.ubuntu.com/ubuntu karmic-security main restricted universe multiverse</pre> <pre>sudo gedit /etc/apt/preferences.d/php</pre> <pre>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</pre> 新建脚本文件php2.5 <pre>#! /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 </pre> 改为可执行,用root账号运行 <pre>sudo chmod +x php2.5</pre> <pre>./php2.5</pre> ==参考== http://2bits.com/drupal-planet/various-ways-running-php-52-ubuntu-1004-lucid-lynx.html http://randyfay.com/node/63 [[Category:服务器]] [[Category:程序开发]]
返回至
PHP5.2
。