ubuntu 下安装lamp 到php5.4

一年多没写博客了,今天写一下。就写 linux ubuntu 下安装lamp

ubuntu 下安装lamp 整了一个礼拜。 晕死了。各种方案,编译的命令安装的。 失败了N次。


最后搞出来了。总结下。


首先用ubuntu现有的命令直接装lamp环境的话。受ubuntu ppa源的限制,php只能装到5.3.10版。我的程序需要5.4以上的php。


最后选定了下面的过程

第一先要把php的安装程序ppa源改成新的,分别是5.4对应 php5-oldstable  和 5.5对应php5

命令如下:

先安装ppa源扩展工具

sudo apt-get install -y ppa-purge

更新ppa源

sudo add-apt-repository ppa:ondrej/php5-oldstable

更新软件列表。
sudo apt-get update 

手动安装lamp

sudo apt-get install apache2 php5 libapache2-mod-php5 mysql-server libapache2-mod-auth-mysql php5-mysql phpmyadmin


上面执行完了如果版本还是

php5.3.10

再执行一下下面的代码,

sudo apt-get install php5

重新升级下,就变程php5.4 了当然想装php5.5 就要吧ppa源改成

sudo add-apt-repository ppa:ondrej/php5


相信很多人在百度或谷歌搜 “ubuntu 安装php5.4的时候,会搜到安装php5.5的代码”,为什么会出现这种情况呢,原因上面说了,ppa源,一般是最新的软件,所以现在的版本是php5.5.要是不小心安装了php5.5要怎么样,才能重新安装php5.4呢?
方法如下:

add-apt-repository  ppa:ondrej/php5-oldstable
apt-get update
ppa-purge ppa:ondrej/php5
apt-get update && apt-get upgrade -y && apt-get autoremove -y && apt-get autoclean -y
apt-get install php5-fpm

下面再附上nginx+php-fpm+mysql的安装方法,有需要的朋友可以到这里看看:ubuntu安装nginx+php-fpm+mysql


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
项目中要用到zend Optimizer,但是目前只支持php5.2,Ubuntu默认安装php版本为5.3,找了好多 方法,终于借助下面这篇文章的方法成功的安装了5.2及5.3两个版本的php Although Drupals 7+ run smoothly on PHP 5.3, Drupal 6 still feels much better with PHP 5.2. Even though D6 core is compatible with PHP 5.3 for quite some time now, a lot of contributes modules still get nasty hiccup when asked to run on the newer version. Therefore developing for both D7 and D6 at the same time becomes much less painful when running both versions of PHP in parallel. One way of doing it is using mod_php5 Apache module to serve PHP 5.3 applications, while running PHP 5.2 applications using fastcgi module. Under Ubuntu 12.04 this can be achieved by installing PHP 5.3 from the repositories and manually compiling and installing PHP 5.2 afterwards. Installing PHP 5.3 from repositories is fairly easy process, which you most probably already have under your belt, so let's just say that it looks more or less like this: sudo apt-get install php5 php5-common php5-cli php5-dev php5-mysql phpmyadmin php5-pgsql phppgadmin php5-gd php5-mcrypt php5-curl php-pear libapache2-mod-php5 php5-xdebug php5-codesniffer What is much more interesting though, and what this post will focus on, is how to add PHP 5.2 to the whole picture and make both those versions work nicely together. Please note that this tutorial is for Apache's name- based virtual hosts, and essentially leaves PHP 5.3 enabled globally while allowing to use PHP 5.2 on specific, selected virtual hosts only.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值