0

I am using following instruction to install latest php on unbutu instance:

Add to /etc/apt/source.list

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

Update apt-key

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

install 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. Previously I was using ppa and decided to not use it bcz of security

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

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

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

Further tests: 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.
sakhunzai
  • 13,900
  • 23
  • 98
  • 159
  • Have you tried installing `php5-cli`? (e.g., `sudo apt-get install php5-cli`.) – Travis Hohl Nov 20 '14 at 13:29
  • yes which adds another dependency into list – sakhunzai Nov 20 '14 at 13:31
  • Did you do it from the command line without the `-y` flag? If so, try `sudo apt-get -f install` as well. The `-f` means fix. It will attempt to correct a system with broken dependencies in place, allowing apt-get to omit any packages in order to deduce a likely solution. – Travis Hohl Nov 20 '14 at 13:37
  • I don't understand one thing, you said you need 5.4 and then you said you need the latest stable, the current stable as of today is 5.6.3. Which one do you need? – Guillermo Mansilla Nov 20 '14 at 13:53
  • I need at-least 5.4, do you suggest any changes in source.list for that ? – sakhunzai Nov 20 '14 at 13:55
  • please check with additional info ,after adding php5-cli – sakhunzai Nov 20 '14 at 14:09

1 Answers1

0

I had a similar situation.

The place where I was working was using an old version on 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.

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)

It contains

PHP 5.4.22

MySQL 5.5.34

Apache 2.4.7

phpMyAdmin 4.0.9

More info: here and here

Community
  • 1
  • 1
Guillermo Mansilla
  • 3,779
  • 2
  • 29
  • 34
  • its not development machine,instead I need to setup this on Amazon EC2 machine. I think I have found another option , use one of the higher versions of the ubuntu ,probably that is the best stable/secure way . – sakhunzai Nov 21 '14 at 07:19