Drupal: .htaccess Access Deny
August 21, 2014 – 7:59 am | No Comment

In this article I will tell how to forbid access to certain resources for some clients. The instructions will include descriptions of different directives.

Read the full story »
CSS Templates

Contain reviews and news about CSS Templates.

Freebies

Contain freebies such as icons, graphics, headers and images for your websites.

Fun Stuff

Contains other fun stuff for entertainment or interesting site showcase.

How-To

Contain technical elaborations on some specific workarounds or common tweak.

Joomla Templates

Contains reviews and news about Joomla templates.

Home » How-To

How to Change PHP 5.3 to РНР 5.2 in Ubuntu 10.4

Submitted by on November 19, 2010 – 5:14 amNo Comment

Some modules work incorrectly with PHP 5.3. Many hosters have PHP 5.2 and you need to use environment similar to the server’s environment for the development works. So you need to dpwngrade php package and related things.

Create a backup сopy of php.ini (place it to /etc/php5)

Create an executable file:

# remove all php packge
sudo aptitude purge `dpkg -l | grep php| awk ‘{print $2}’ |tr "\n" " "`
# use karmiс for php pakage
# pin-params:  a (archive), c (components), v (version), o (origin) and l (label).
echo -e "Package: php5\nPin: release a=karmic\nPin-Priority: 991\n" | sudo tee /etc/apt/preferences.d/php > /dev/null
apt-cache search php5-|grep php5-|awk ‘{print "Package:", $1,"\nPin: release a=karmic\nPin-Priority: 991\n"}’|sudo tee -a /etc/apt/preferences.d/php > /dev/null
apt-cache search -n libapache2-mod-php5 |awk ‘{print "Package:", $1,"\nPin: release a=karmic\nPin-Priority: 991\n"}’| sudo tee -a /etc/apt/preferences.d/php > /dev/null
echo -e "Package: php-pear\nPin: release a=karmic\nPin-Priority: 991\n" | sudo tee -a /etc/apt/preferences.d/php > /dev/null
# add karmic to source list
grep ‘main restricted’ /etc/apt/sources.list|grep -v "#"| sed s/lucid/karmic/g | sudo tee /etc/apt/sources.list.d/karmic.list > /dev/null
# update package database (use apt-get if aptitude crash)
sudo apt-get update
# install php
sudo aptitude install -t karmic php5-cli php5-cgi
# or (and) sudo apt-get install -t karmic  libapache2-mod-php5
sudo aptitude hold `dpkg -l | grep php5| awk ‘{print $2}’ |tr "\n" " "`
#done

Run:

php_installed=`dpkg -l | grep  php| awk  ‘{print $2}’ |tr "\n" " "`

This will save the list of additional packages and libraries you will need after downgrade. You can easy view them:

echo $php_installed

Run the earlier created script.
Run:

sudo apt-get install $php_installed

This will work for many packages. But phpmyadmin requires php5-mcrypt. They are both in "universe" repository rather than in  "main restricted". Therefore we will add the following lines to /etc/apt/sources.list.d/karmic.list:

sudo gedit /etc/apt/sources.list.d/karmic.list

deb http://archive.ubuntu.com/ubuntu/ karmic universe
deb http://archive.ubuntu.com/ubuntu/ karmic-updates universe
deb http://archive.ubuntu.com/ubuntu/ karmic multiverse
deb http://archive.ubuntu.com/ubuntu/ karmic-updates multiverse

Run:

sudo apt-get update

All packages will be updated.

If you don’t wish to do this manually, you can replace the 10 line to the following one in the script above:

egrep ‘(main restricted|universe|multiverse)’ /etc/apt/sources.list|grep -v "#"| \
sed s/lucid/karmic/g | sudo tee /etc/apt/sources.list.d/karmic.list > /dev/null

Leave a comment!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.