Home

With or Without you

PlaceWhereBonoCantLive

Upgrade PHP and MySQL

General info on how to upgrade PHP and MySQL in CentOS 5.5

 

add repository:

	
32bits: wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm
64bits: wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
	
rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
rpm -K rpmforge-release-0.5.2-2.el5.rf.*.rpm
rpm -i rpmforge-release-0.5.2-2.el5.rf.*.rpm

Now remove the current PHP and MYSQL installed in your system:

yum erase php php-common mysql

And finnaly, install the new version:

yum --enablerepo=remi install php mysql

Latin1 to UTF8

After a whole day trying to convert a database from Latin1 to UTF8, I found out a pretty sweet and simple solution:
(thanks bawdo2001!)

1) Dump your database into an SQL / Text file using the following:

mysqldump --opt --default-character-set=latin1 --skip-set-charset databasename > filename.sql

 

2) Replace all the settings relate to the previous character set (Latin1) to the new one (UTF8):

sed  -e 's/latin1/utf8/g' -i filename.sql

 

3)Create the new database and import the data:

mysql -e "CREATE DATABASE new_db CHARACTER SET utf8 COLLATE utf8_general_ci"
mysql --default-character-set=utf8 new_db < filename.sql


That's it!

Rokdownloads and Virtuemart

Another day I was facing a problem integrating the Rokdownloads plugin into the Virtuemart Product Description.

After reading a lot of posts in forums, the solution to just enable joomla plugins in virturemart did in fact work with all 3rd part plugins that I've installed in my client website but it didn't with Rokdownloads.

So, as I have already done a lot of work customizing the solution for this customer, I have no option but to go through the code and try to find out what the heck was going on and the solution was surprisingly quite simple.

The rokdownloads plugin didn't use a common function in joomla called onPrepareContent, so the only thing that you have to do is to include the following code in /plugins/content/rokdownloads.php (~line 60):

function onPrepareContent( &$article, &$params, $limitstart ) {
$this->onBeforeDisplayContent($article, $params, $limitstart );
}

Another solution (but I haven't tested it yet) will be just renaming the function onBeforeDisplayContent to onPrepareContent. But I wasn't sure if this function would be used / called in any other process / function inside the Rokdownloads component.

So to avoid spending more time analyzing the whole component tree, I decided to keep the above solution.