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.
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
More info: here and here