[Ubuntu] ubuntu13.04 从php5.4降级到php5.3
ubuntu12.10以后,默认的deb安装库上面的php版本已经是5.4了,公司的项目使用5.4的时候,还是会出现很多问题,所以不得不降级安装5.3
顺便说一句,我原来的环境是nginx + php5.4 + mysql 的,现在只是把php5.4降级到php5.3,其它的不修复。
新建一个叫做down_to_php53.sh,然后复制下面代码进去
#!/bin/bash
#
# Original for 5.3 by Ruben Barkow (rubo77) http://www.entikey.z11.de/
# release PHP5. to 5.3 by Emil Terziev ( foxy ) Bulgaria # 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 precise 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
fi
echo " OK"; #install aptitude before, if you don`t have it:
apt-get update
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 -l | 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 precise:
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=precise
#Pin-Priority:
#
#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 precise: echo ''>/etc/apt/preferences.d/php5_3
for i in $PHPLIST ; do echo "Package: $i
Pin: release a=precise
Pin-Priority:
">>/etc/apt/preferences.d/php5_3; done echo "# needed sources vor php5.3:
deb http://bg.archive.ubuntu.com/ubuntu/ precise main restricted
deb-src http://bg.archive.ubuntu.com/ubuntu/ precise main restricted deb http://bg.archive.ubuntu.com/ubuntu/ precise-updates main restricted
deb-src http://bg.archive.ubuntu.com/ubuntu/ precise-updates main restricted deb http://bg.archive.ubuntu.com/ubuntu/ precise universe
deb-src http://bg.archive.ubuntu.com/ubuntu/ precise universe
deb http://bg.archive.ubuntu.com/ubuntu/ precise-updates universe
deb-src http://bg.archive.ubuntu.com/ubuntu/ precise-updates universe deb http://bg.archive.ubuntu.com/ubuntu/ precise multiverse
deb-src http://bg.archive.ubuntu.com/ubuntu/ precise multiverse
deb http://bg.archive.ubuntu.com/ubuntu/ precise-updates multiverse
deb-src http://bg.archive.ubuntu.com/ubuntu/ precise-updates multiverse
deb-src http://bg.archive.ubuntu.com/ubuntu/ natty-backports main restricted universe multiverse deb http://security.ubuntu.com/ubuntu precise-security main restricted
deb-src http://security.ubuntu.com/ubuntu precise-security main restricted
deb http://security.ubuntu.com/ubuntu precise-security universe
deb-src http://security.ubuntu.com/ubuntu precise-security universe
deb http://security.ubuntu.com/ubuntu precise-security multiverse
deb-src http://security.ubuntu.com/ubuntu precise-security multiverse deb-src http://archive.canonical.com/ubuntu natty partner deb http://extras.ubuntu.com/ubuntu precise main
deb-src http://extras.ubuntu.com/ubuntu precise main deb http://bg.archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://bg.archive.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse deb http://archive.canonical.com/ubuntu precise partner
deb-src http://archive.canonical.com/ubuntu precise partner " >> /etc/apt/sources.list.d/precise.list aptitude update #apache2ctl restart echo install new from precise:
aptitude -t precise install $PHPLIST # at the end retry the modul libapache2-mod-php5 in case it didn't work the first time:
#aptitude -t precise install libapache2-mod-php5 #apache2ctl restart
然后执行
chmod +x down_to_php53.sh
sudo ./down_to_php53.sh
执行完之后,重启php5-fpm和ngnix
sudo /etc/init.d/php5-fpm restart
sudo /etc/init.d/nginx restart
这时,访问 http://127.0.0.1/,会出现502错误,查看ngnix日志,有如下问题
// :: [crit] #: * connect() to unix:/var/run/php5-fpm.sock failed (: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET /phpinfo.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "127.0.0.1"
// :: [error] #: * rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 127.0.0.1, server: localhost, request: "GET /favicon.ico HTTP/1.1", host: "127.0.0.1"
这是因为原来在nginx,我是这样配置的
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
#
# # With php5-cgi alone:
# fastcgi_pass 127.0.0.1:;
# # With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
使用socket来连接,所以降级之后,还要修改一下新的配置文件
vim /etc/php5/fpm/pool.d/www.conf
找到
listen = 127.0.0.1:
加入
listen = /var/run/php5-fpm.sock
就可以了
Have fun with Ubuntu!
[Ubuntu] ubuntu13.04 从php5.4降级到php5.3的更多相关文章
- [Ubuntu] Ubuntu13.04, the desktop freezed after login
My os version is Ubuntu13.04, today, after started and logined, my desktop freezed. But i can still ...
- [Ubuntu] Ubuntu14.04 64bit 编译安装nginx1.7+php5.4+mysql5.6
我的操作系统是Ubuntu14.04,其它linux系统的操作流程类似. 主要安装的软件是nginx1.7+php5.4+mysql5.6 1. 创建必要目录 sudo mkdir ~/setup s ...
- Ubuntu 18.04 将gcc版本降级为5.5版本
Remark: Polynomial algebra 程序由于版本问题只能在gcc 5.0 版本运行, 而ubuntu更新会将gcc 更新到7.0版本,出现冲突(报错:如下) collect2: er ...
- [ubuntu] ubuntu13.04安装rabbitcvs管理svn
加入源 sudo add-apt-repository ppa:rabbitvcs/ppa 更新 sudo apt-get update 安装软件 sudo apt-get install rabbi ...
- Ubuntu 16.04 环境下配置apache2.4 + php5.6
相信用惯了Windows的朋友一开始接触Linux是很崩溃的,因为很多东西都是通过命令行来完成的,包括安装绝大多数的开发工具以及环境,那么在Ubuntu下其实可以直接通过apt-get指令来安装apa ...
- Ubuntu 16.04系统下安装PHP5.6*
Ubuntu 16.04系统默认php7,并没有php5*的包,所以需要自己安装: 方法: 1.删除所有的php包列出安装的php包,dpkg -l | grep php| awk '{print $ ...
- 【转】How to build and install PHP 5.6.9 from source on Ubuntu 14.04 VPS
原文 https://vpsineu.com/blog/how-to-build-and-install-php-5-6-9-from-source-on-ubuntu-14-04-vps/ In t ...
- Ubuntu 12.04 安装 Apache2+PHP5+MySQL
LAMP是Linux web服务器组合套装的缩写,分别是Apache+MySQL+PHP.此教程教大家如何在Ubuntu 12.04 LTS server 上安装Apache2服务器,包括PHP5(m ...
- Ubuntu 16.04 LTS 降级安装GCC 4.8
转载自https://www.linuxidc.com/Linux/2017-03/142299.htm Ubuntu 16.04 LTS 降级安装GCC 4.8 [日期:2017-03-28] 来源 ...
随机推荐
- SQLSERVER 表名数据库名作为变量 必须使用动态SQL(源自网络)
动态语句基本语法: 1 :普通SQL语句可以用exec执行 Select * from tableName exec('select * from tableName') exec sp_execut ...
- rabbitMq 转自 http://gaoyangang.iteye.com/blog/1566600
rabbitMq 转自 http://gaoyangang.iteye.com/blog/1566600
- golang AES/ECB/PKCS5 加密解密 url-safe-base64
因为项目的需要用到golang的一种特殊的加密解密算法AES/ECB/PKCS5,但是算法并没有包含在标准库中,经过多次失败的尝试,终于解码成功,特此分享: /* 描述 : golang AES/EC ...
- Java 实现网站当前在线用户统计
1. import java.util.HashSet; import javax.servlet.ServletContext; import javax.servlet.http.HttpSess ...
- JQuery:JQuery设置HTML
JQuery:设置HTML1.Query - 设置内容和属性设置内容 - text().html() 以及 val()我们将使用前一章中的三个相同的方法来设置内容: text() - 设置或返回所选元 ...
- C语言:十进制进制转换为其他进制(思想:查表法)
// // main.c // Hex conversion // // Created by ma c on 15/7/22. // Copyright (c) 2015年 bjsxt. A ...
- JQuery 操作HTML元素 示例
http://www.w3school.com.cn/jquery/jquery_dom_add.asp http://www.w3school.com.cn/jquery/jquery_dom_re ...
- C# --2007Access链接字符串
public static string connectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDi ...
- jQuery基础修炼圣典—DOM篇(二)jQuery遍历
1.children()方法 jQuery是一个合集对象,如果想快速查找合集里面的第一级子元素,此时可以用children()方法.这里需要注意:.children(selector) 方法是返回匹配 ...
- MvvmLight 绑定
添加MvvmLight引用,通过Nuget: 加载nuget以后会有ViewModelLocator.cs: 新建自己的ViewModel,继承ViewModelBase: View 通过资源引用Vi ...