Downgrade php version from 5.3 to 5.2 on Ubuntu 10.04 i386

I have chance to install new server with standard requirement. SSH, Bind9 and LAMP.

All process is smooth using i386 version of Ubuntu 10.04 but my friend complain about his web application not work well and after little investigation it looks like due to PHP version.

Quick search on Google lead me to RandyFay post about downgrade PHP version to 5.2 on Ubuntu 10.04

I follow the method and rewrite it with a few things that might useful for newbie like me :-)

Note :

I use ubuntu 10.04 i386 and username : alam

Let start

Download required files for PHP 5.2 from Ubuntu Karmic repository

# wget

# mv /home/pusda/karmic_0.list /etc/apt/sources.list.d

# wget

# mv /home/pusda/php_1. /etc/apt/preferences.d/php

Find out installed PHP version

# dpkg –get-selections | grep php

libapache2-mod-php5                             install
php-db                                          install
php-pear                                        install
php5                                            install
php5-cli                                        install
php5-common                                     install
php5-gd                                         install
php5-mcrypt                                     deinstall
php5-mysql                                      install

Delete those PHP with apt-get remove

# apt-get remove libapache2-mod-php5 php-db php-pear php5 php5-cli php5-common php5-gd php5-mcrypt php5-mysql

# apt-get autoremove

Update repository and reinstall PHP

#apt-get update

#apt-get install php5 libapache2-mod-php5 php-db php5-cli php5-common php5-xsl php5-gd php-pear php5-mysql php5-curl php5-memcache

Check PHP version

# php -v

PHP Warning:  PHP Startup: Unable to load dynamic library ‘/usr/lib/php5/20060613+lfs/’ – /usr/lib/php5/20060613+lfs/ cannot open shared object file: No such file or directory in Unknown on line 0
PHP 5.2.10-2ubuntu6 with Suhosin-Patch 0.9.7 (cli) (built: Oct 23 2009 16:30:10)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies

Dealing with php5-mcrypt error

# apt-get install php5-mcrypt

Reading package lists… Done
Building dependency tree
Reading state information… Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
php5-mcrypt: Depends: phpapi-20090626+lfs
E: Broken packages

Quick solution for php5-mcrypt installation error

# nano /etc/apt/preferences.d/php

put these lines :

Package: php5-mcrypt
Pin: release a=karmic
Pin-Priority: 991

at the bottom.

Try reinstall php5-mcrypt

# apt-get install php5-mcrypt

Reading package lists… Done
Building dependency tree
Reading state information… Done
The following extra packages will be installed:
Suggested packages:
libmcrypt-dev mcrypt
The following NEW packages will be installed:
libmcrypt4 php5-mcrypt
0 upgraded, 2 newly installed, 0 to remove and 4 not upgraded.
Need to get 91.4kB of archives.
After this operation, 332kB of additional disk space will be used.
Do you want to continue [Y/n]?y

Recheck php version after install php5-mcrypt

# php -v

PHP 5.2.10-2ubuntu6 with Suhosin-Patch 0.9.7 (cli) (built: Oct 23 2009 16:30:10)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies


PHP successfully downgrade to 5.2.10

Howto install Aptana studio with php support

I’m old fashion student who use phpcoder as tool for coding php until my friend suggest aptana editor with php support. When everything configured properly I’ll have php interpreter for immediate debug purpose and I think it’s suitable for new php user :-)

I decide to give this software a try and here it goes.

Install Aptana

Aptana studio available from their website, I use free version. (1.5)

After download it I run installer to get installation work.

Welcome to Aptana Studio 1.5 setup, click Next to start.


read more »

How to transfer haloscan comment into wordpress self hosting

My wife like blogspot a lot until slowly she found more feature offered by wordpress, one of them is ‘future posting’ . After think alot she decide to move from blogspot to wordpress self hosting.

The problem came when I must deal with haloscan, luckly I found 2 resources that help me to import haloscan comment into wordpress table.

In general the process are :

1. Signup for free blog at

2. Use import feature from blogspot to

Click Authorize

Follow all the rest steps.

read more »

undefined function imagecreatefromjpeg()

Call to undefined function imagecreatefromjpeg() in /home/materi/prog/cms_study/admin/pageuploadadd.php on line 88
Yes, that message show up when my friend try to access web based application.

I think thats my fault :-)

Doing preliminary check :

edp# pkg_info | grep php5-gd
edit /etc/make.conf



edp# whereis php5-gd
php5-gd: /usr/ports/graphics/php5-gd
edp# cd /usr/ports/graphics/php5-gd && make install

edp# apachectl restart

That message disappear :-)

change wordpress password manually

Reset wordpress password using provided link not work, sadly no phpmyadmin available :-)

Fortunately I have shell access which is enough, using built in md5 function to generate and update the password, here’s the steps:

1. Creating md5

– Using shell

Just type :

md5 -s your chosen password

– Make php script with this content :


$string=’your chosen password’;

echo md5($string);


save this script and execute on your server.

2. Update wordpress table

– Using shell

login to mysql with username and password that written in wp-config.php

mysql -uusername -ppassword -pdatabase_name;

use database_name;

update user table set password=’md5 generated hash’ where username=’current_username’;

– Using php script

Make this script




//updating table

$update=mysql_query(“update table_user set password=’md5 generated hash’ where username=’current_username'”);


save this script as change.php, upload to server and execute.


I can login to my wordpress account again.