Eclipse / Zend Studio crashing on New project on Ubuntu KDE

Posted August 30th, 2015 in Razno by Metod

If you are using the latest stable versions of either Eclipse or Zend Studio on Ubuntu with KDE installed you might have run into some trouble along the way. If you have oxygen theme installed the IDE will crash whenever you want to create a new project. Or maybe the close buttons won’t work. Plenty of problems.

However there is a simple solution which I found digging around the comments in bug reports.

For oxygen, edit the normally already existing file “/usr/share/themes/oxygen-gtk/gtk-2.0/gtkrc” and change
GtkComboBox::appears-as-list = 1
GtkComboBox::appears-as-list = 0

Works like a charm!

All credit goes to Axel Müller for pointing to the original comment made by Hugo Pereira Da Costa.

P.S.: The workaround for this is quite old. However since google search does not provide the straight up answer and the problem persists in latest Ubuntu 14.04 LTS I have decided this is worth a post.

Setup ssh-agent in KDE in Ubuntu

Posted May 28th, 2011 in Razno by Metod

I began toying around with KDE desktop since I got tired of Gnome. I wanted to try something new and shiny. Everything went great, it is highly customizable etc. Only one thing did not work. When ssh-ing to a server it did not ask me for keychain password anymore. So how to fix that?

First, if you don’t already have it installed, install ssh-askpass:

sudo apt-get install ssh-askpass

Ok, now that that is installed, we must ensure that it asks us for password everytime we log on. For KDE we have to create a script inside ~/.kde/Autostart/ directory.


export SSH_ASKPASS=/usr/bin/ssh-askpass
ssh-add < /dev/null

You can also specify the name of the key file:

ssh-add ~/.ssh/some_other_key < /dev/null

The startup script has to be correctly chmod-ed:

chmod 755

Now log out and log in again and it should ask you for password. Happy ssh-ing. 🙂

Multiple PHP versions with Apache 2, FastCGI, PHPFarm on Ubuntu

Posted December 2nd, 2010 in Tehnikalije by Metod

This tutorial is a part of the “Setting up your local development environment” series. It is based on this article while keeping in mind that in previous apache tutorial we compiled apache from source. So I’m definitely not taking all the credit for it. But there are some modifications.

Starting with PHPFarm, we need Git installed in order to check it out. If you don’t have it installed:

sudo apt-get install git-core

Now create a directory in which PHP versions will reside. The directory of my liking is /usr/local/php, so I will use that. You can of course change that.

cd /usr/local

Clone the phpfarm repository.

git clone git:// php

Now we have to edit the configuration options which phpfarm will use to compile php.

cd php/src

We can use more general configuration options or very strict ones. Default configuration can be overridden by creating a file called or a bit more specific like or very strict like Since the configurations for 5.2 and 5.3 are different and I like to be a strict person, I will create two configurations:

  • contents (these config values were also mentioned in previous tutorial):

	--enable-cli \
	--with-pear \
	--with-openssl=/usr \
	--with-iconv \
	--with-curl \
	--with-mysqli \
	--enable-mbstring \
	--enable-exif \
	--with-jpeg-dir=/usr \
	--with-zlib \
	--with-zlib-dir \
	--with-png-dir=/usr \
	--with-gd \
	--with-gettext \
	--enable-gd-native-ttf \
	--with-mhash \
	--enable-ftp \
	--with-pspell \
	--with-mcrypt \
	--enable-bcmath \
	--with-mime-magic \
	--with-pdo-mysql \
	--enable-sockets \
	--enable-soap \
        --enable-calendar \
	--enable-fastcgi \
	--enable-force-cgi-redirect \
" contents:

	--with-mysqli=mysqlnd \
	--with-pdo-mysql=mysqlnd \
	--enable-cli \
	--with-pear \
	--with-openssl=/usr \
	--with-iconv \
	--with-curl \
	--enable-mbstring \
	--enable-exif \
	--with-zlib \
	--with-zlib-dir \
	--with-gd \
	--with-gettext \
	--enable-gd-native-ttf \
	--with-mhash \
	--enable-ftp \
	--with-pspell \
	--with-mcrypt \
	--enable-bcmath \
	--enable-sockets \
	--enable-soap \
	--enable-calendar \
	--with-png-dir=/usr \

For PHP 5.3 we don’t need the cgi parameters, since these are already enabled by default.

On Ubuntu 11.04, the configuration might fail with error messages about libjpeg and/or libpng. What you can do is the following:

sudo apt-get install libjpeg8-dev

Install the libjpeg8-dev package. This will solve the libjpeg error message.

sudo ln -s /usr/lib/x86_64-linux-gnu/ /usr/lib/

Create a symbolic link to the in the /usr/lib directory. This will solve the libpng error message.

Next step – compiling PHP.

sudo ./ 5.2.17
sudo ./ 5.3.18

Where the number after the ./ is the PHP version you wish to compile.

Now that we have compiled PHP, we can move on to set up apache. If you followed the apache tutorial, first of we need to recompile it.

./configure \
	--prefix=/usr/local/apache2.2.22 \
	--with-included-apr \
	--enable-mods-shared=all \
	--enable-so \
	--enable-mod-rewrite \
	--enable-suexec \

These are just my configuration options. The options you have to pay attention to for this topic are:

  • –enable-so
  • –enable-suexec
  • –enable-suexec-caller=daemon – You can change this according to which user your apache runs under.
sudo make install

Apache should be up and running. Next stop – FastCGI module.

Download and extract the latest (current) source from

tar xzf mod_fastcgi-current.tar.gz
cd mod_fastcgi-2.4.6

Next thing to do is rename Makefile.AP2 to Makefile, so we can compile it for apache 2.

cp Makefile.AP2 Makefile

Compile and install the module.

make top_dir=/usr/local/apache2.2.22
sudo make install top_dir=/usr/local/apache2.2.22

The top_dir parameter is optional. If you compiled apache to the more usual location like /usr/local/apache2, you do not need to set this option.

Now that we have mod_fastcgi module compiled, we can load it as a shared object. Add the following line to your httpd.conf:

LoadModule fastcgi_module modules/

If you had previously ran PHP as an apache module, you must disable it. You can only run PHP either as CGI or an apache module. So in httpd.conf, comment out this line:

# LoadModule php5_module modules/

Create a .conf file (you can call it what you want) – i.e. php-fcgi.conf and put the following content inside:

<IfModule mod_fastcgi>
    FastCgiWrapper /usr/lib/apache2.2.22/bin/suexec
    FastCgiConfig -idle-timeout 110 -killInterval 120 -pass-header
        HTTP_AUTHORIZATION -autoUpdate

    ScriptAlias /php-fcgi/ /var/www/cgi-bin/

And include it in your main httpd.conf:

# Include FastCGI configuration
Include conf/php-fcgi.conf

Now create a directory for CGI scripts.

sudo mkdir /var/www/cgi-bin

And create scripts.

sudo nano /var/www/cgi-bin/php-cgi-5.2.17
sudo nano /var/www/cgi-bin/php-cgi-5.3.18

And put something like the following in. Just change the version of PHP.


export PHPRC



# which php-cgi binary to execute
exec /usr/local/php/phpfarm/inst/php-${version}/bin/php-cgi

These scripts should be executable. So we set permissions to 0755.

cd /var/www/cgi-bin
sudo chmod +x *

Now we configure apache virtualhosts. Each virtualhost will have it’s own subdomain and PHP version.

NameVirtualHost localhost.53:80
<VirtualHost localhost.53:80>
  ServerName localhost.53
  DocumentRoot /var/www
  <Directory "/var/www">
    AddHandler php-cgi .php
    Action php-cgi /php-fcgi/php-cgi-5.3.18

Do the same for all versions of PHP.

We are almost there. Since these subdomains (asumingly) do not exist yet, we must point them to your localhost IP.

sudo nano /etc/hosts

Just add your subdomains after the localhost definition. It should look something like this: localhost localhost.52 localhost.53

Everything is set, so just restart the apache.

sudo /usr/local/apache2.2.22/bin/apachectl -k restart

Put a file phpinfo.php in /var/www directory with the following line:

And test it. If everything went well, you should see different PHP versions on different subdomains.

  • http://localhost.52/phpinfo.php – PHP 5.2.17
  • http://localhost.53/phpinfo.php – PHP 5.3.18


Post updated on November 12th, 2012th to reflect latest updates.

Setting up your local development environment – PHP

Posted July 3rd, 2010 in Tehnikalije by Metod

Last time we went through steps needed for setting up apache. Now we will set up PHP. I encourage you to read the article on multiple PHP versions, which takes use of PHPFarm that makes things a lot easier. Plus you get to have multiple PHP versions installed.

Download and prepare

First few steps are practically the same as for the apache. Download the source and check md5.

$ md5sum php-5.4.8.tar.gz | grep 'b25b735f342efbfdcdaf00b83189f183'

Extract the archive.

$ tar xzf php-5.4.8.tar.gz

Go into the extracted directory.

$ cd php-5.4.8

Configure for compiling

$ ./configure \
--prefix=/usr/local/php5.4.8 \
--with-apxs2=/usr/local/apache2.2.22/bin/apxs \
--with-config-file-path=/usr/local/php5.4.8/conf \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--enable-cli \
--with-pear \
--with-openssl \
--with-iconv \
--with-curl \
--enable-intl \
--enable-mbstring \
--enable-exif \
--with-zlib \
--with-gd \
--with-gettext \
--enable-gd-native-ttf \
--with-mhash \
--with-pspell \
--with-mcrypt \
--enable-bcmath \
--enable-sockets \
--enable-soap \
--enable-calendar \
--with-png-dir=/usr \

You don’t need all of these extras, they just might be useful to you. Some of the more important ones are:

  • –prefix=… sets the location of the PHP installation.
  • –with-apxs2=… sets the location of the apxs binary of the apache. Adjust accordingly.
  • –with-config-file-path=… sets the location of the php.ini configuration file. I just set it so it is more clear where the .ini file will be.
  • –enable-cli whether or not you want to use php from the command line.

You can read more about the configuration options in the PHP manual.

On Ubuntu 11.04, the configuration might fail with error messages about libjpeg and/or libpng. What you can do is the following:

# apt-get install libjpeg8-dev

Install the libjpeg8-dev package. This will solve the libjpeg error message.

# ln -s /usr/lib/x86_64-linux-gnu/ /usr/lib/

Create a symbolic link to the in the /usr/lib directory. This will solve the libpng error message.


$ make

If this error occures while doing “make”:

/usr/bin/ld: cannot find -lltdl collect2: ld returned 1 exit  status

Just install the libltdl-dev package. Should be something similar for other linux distributions.

# apt-get install libltdl-dev

It is a good practice to run tests and report any possible bugs by running this command. It however is not mandatory to do it.

$ make test

This might take a while. After tests are through, there might be a fail or two, so you can decide if you want to report those or not.

Let’s go on and install it. This command must be run as super user.

# make install


Now we have to copy the php.ini to the appropriate directory.

# cp php.ini-recommended /usr/local/php5.4.8/conf/php.ini

Next, we configure apache to handle our PHP scripts.

# gedit /usr/local/apache2.2.22/conf/httpd.conf

Find a line which starts with AddType and add this below.

AddType application/x-httpd-php .php

Than in line which starts with DirectoryIndex add this.


Save the file and restart apache.

# /usr/local/apache2.2.22/bin/apachectl -k restart


Go to your documents root directory. In previous tutorial we used /var/www directory for this.

In this directory create a file named test.php and put this in it:

Now go to http://localhost/test.php

If you see a lot of data about your PHP installation, you have succeeded.


Post updated on November 12th, 2012 to reflect newest updates.

Setting up your local web development environment – Apache

Posted June 25th, 2010 in Tehnikalije by Metod

This is the first on in the series of tutorials on how to set up your local web development environment on linux (I’m using Ubuntu). It is targeting those people, who don’t know their way around linux, but don’t want to use generic packages. It’s more fun. 🙂

Download and prepare

First, you go to the apache homepage. You download apache, check sha1, because it can get corrupted!

$ sha1sum httpd-2.2.22.tar.gz | grep 'bf3bbfda967ac900348e697f26fe86b25695efe9'

If a line is returned, the file is OK, we can proceed, else, return to step 1.

Extract the archive.

$ tar xzf httpd-2.2.22.tar.gz

Move into the directory of the extracted archive.

$ cd httpd-2.2.22

Configure for compiling

Next, we have to configure apache, before we compile it.

$ ./configure --prefix=/usr/local/apache2 --enable-so --enable-mods-shared=all --enable-mod-rewrite

  • –prefix=/usr/local/apache2 tells apache where to install all the files needed. In this case we are installing apache to /usr/local/apache2 directory.
  • –enable-mods-shared=all tells apache to compile all modules as dynamic shared modules. We can then enable these modules in httpd.conf file, via the LoadModule directive.
  • –enable-mod-rewrite tells apache to enable mod rewrite.


If you get this error during the configuration:

mod_deflate has been requested but can not be built due to prerequisite failures

This happened because we enabled all mods by default, one of which is the mod_deflate that uses the zlib library. You can simply install its headers on ubuntu.

# apt-get install zlib1g-dev

The dependencies should pass.


$ make

Next one must be executed as super user.

# make install

Test it

Now, apache should be working. Let’s test it.

# /usr/local/apache2/bin/apachectl -k start

Go to: http://localhost

You should see a “It works!” on your screen.

But when we started apache, it threw out an error:

httpd: Could not reliably determine the server's fully qualified domain name, using for ServerName

Configure it

It’s time to configure it, so it won’t throw errors at us. You can use different text editor than gedit (vi, nano, mcedit … )

# gedit /usr/local/apache2/conf/httpd.conf

ServerAdmin → change it to your email, just for a clean configuration file.

Uncomment ServerName directive (remove # in front of it) and change to localhost. With this, we got rid of that error from before.

DocumentRoot → change to directory in which you want to have your html, php etc. files.

<Directory “/usr/local/apache2/htdocs”> → change if you changed the DocumentRoot in the previous step.

Here we must change the line AllowOverride None to AlloweOverride All if we want mod_rewrite to function properly.

Check if the syntax of the configuration file is OK.

$ /usr/local/apache2/bin/apachectl -t

If everything is OK, restart apache.

# /usr/local/apache2/bin/apachectl -k restart

You’re good to go!

Post updated on February 1st, 2012 to reflect latest apache version.