简体   繁体   English

需要在Ubuntu 12.04 LTS Precision上安装php5.4

[英]Need to install php5.4 on ubuntu 12.04 LTS precise

I am using following instruction to install latest php on unbutu instance: 我正在使用以下说明在unbutu实例上安装最新的php:

Add to /etc/apt/source.list 添加到/etc/apt/source.list

deb http://packages.dotdeb.org stable all
deb-src http://packages.dotdeb.org stable all

Update apt-key 更新apt键

sudo wget -q  http://www.dotdeb.org/dotdeb.gpg
sudo apt-key add dotdeb.gpg
sudo apt-get update

install apache2 + php 安装apache2 + php

`sudo apt-get install -y apache2 php5 libapache2-mod-php5`

Output: 输出:

The following packages have unmet dependencies:
 libapache2-mod-php5 : Depends: libxml2 (>= 2.8.0) but 2.7.8.dfsg-5.1ubuntu4 is to be installed
                       Recommends: php5-cli but it is not going to be installed

I need a stable way to install latest php. 我需要一种稳定的方式来安装最新的PHP。 Previously I was using ppa and decided to not use it bcz of security 以前我使用的是PPA,因此决定不使用它

sudo apt-get install -y python-software-properties
sudo add-apt-repository -y ppa:ondrej/php5-oldstable

I wonder if there is a better way to setup latest php+apache2+mysql , I have to script the process to automate the installation and invoke it through build script 我想知道是否有更好的方法来设置最新的php + apache2 + mysql,我必须编写脚本以自动化安装过程并通过构建脚本调用它

Side note/problem background: 旁注/问题背景:

I am using Phing ssh task to invoke the script to setup php+apache2+mysql, which break with add-apt-repository command for weird reason 我正在使用Phing ssh任务来调用脚本来设置php + apache2 + mysql,出于奇怪的原因,该脚本与add-apt-repository命令一起中断

Reference: 参考:

 <ssh host="${deploy.host}"
             username="${deploy.user}"
             privkeyfile="${deploy.pem}"
             pubkeyfile="${deploy.pub}"
             command="${ssh_command}"
             display="false"
             property="ssh.output"
             failonerror="true"
                />

ssh_command where I invoke the script ssh_command我在哪里调用脚本

Further tests: sudo apt-get install -y apache2 php5 php5-cli libapache2-mod-php5 php5-mysql php5-gd php5-memcache php5-mcrypt php5-xsl 进一步测试: sudo apt-get install -y apache2 php5 php5-cli libapache2-mod-php5 php5-mysql php5-gd php5-memcache php5-mcrypt php5-xsl

Output: 输出:

The following packages have unmet dependencies:
 libapache2-mod-php5 : Depends: libxml2 (>= 2.8.0) but 2.7.8.dfsg-5.1ubuntu4 is to be installed
 php5-cli : Depends: libxml2 (>= 2.8.0) but 2.7.8.dfsg-5.1ubuntu4 is to be installed
            Depends: libedit2 (>= 2.11-20080614-4) but 2.11-20080614-3ubuntu2 is to be installed
E: Unable to correct problems, you have held broken packages.

I had a similar situation. 我也有类似的情况。

The place where I was working was using an old version on PHP (5.3.8). 我工作的地方是在PHP(5.3.8)上使用旧版本。

I installed the latest version of Ubuntu in my desktop and then I realised that downgrading from 5.5 to 5.3 was almost impossible, too many dependencies to handle, the best solution I could find was to use an "all-in-one" package like XAMPP. 我在桌面上安装了最新版本的Ubuntu,然后我意识到从5.5降级到5.3几乎是不可能的,要处理的依赖项太多,我能找到的最佳解决方案是使用“多合一”包,例如XAMPP 。

Even though I hate those solutions I changed my mind after a couple of hours, it did exactly what it was supposed to do, I didn't have to do any sorcery in the package manager or alter any configuration files. 尽管我讨厌这些解决方案,但几个小时后我改变了主意,但它确实做到了应做的事情,我不必在程序包管理器中进行任何操作或更改任何配置文件。

Here is the XAMPP version I would use in your case (1.8.2-3 version - PHP 5.4 based) 这是我将在您的情况下使用的XAMPP版本(1.8.2-3版本-基于PHP 5.4)

It contains 它包含

PHP 5.4.22 PHP 5.4.22

MySQL 5.5.34 MySQL 5.5.34

Apache 2.4.7 阿帕奇2.4.7

phpMyAdmin 4.0.9 phpMyAdmin 4.0.9

More info: here and here 更多信息: 这里这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM