Alex Moreno

A Drupal Developer in London

changing vhost.conf without restarting apache

Sometimes you need to change some parameters to your apache virtual host. Then, when you need to check the changes, in plesk you'd probably will have to execute the next command to see the changes:

/usr/local/psa/admin/sbin/httpdmng --reconfigure-domain

Otherwise, restarting apache (/etc/init/apache2 restart) could not make the trick.

I allways forgot this little trick... never more, because Programadores Web will remind it me :-).


Programadores drupal y php en España

De verdad que España me parece cada vez más lejana. Estoy viendo una oferta de trabajo y de verdad que los sueldos son "tercermundistas".

El país no va a salir de la economía agro-inmobiliaria en la que se ha basado hasta ahora si se está ofreciendo por un senior lo que en Londres se ofrece para un junior de cualquier tecnología. Menciono Londres por poner un ejemplo que conozco bien (porque vivo y trabajo en Londres), pero en el resto de Europa ocurre exactamente igual.


Apache Solr + Drupal

Download the apachesolr module from, and put it in sites/all/modules:

download solr-php-client, version 22

and uncompress it in the apachesolr module directory.

Ready to activate the module, but we will did not installed the Apache server, so the module will not work.


paging results in Drupal

Paginating the results in Drupal is incredible incredible easy. You just have to remember the two "magic functions":


  • pager_query($sql, $count);
  • theme('pager',10);


pager_query substitutes the typical db_query. Just something like that: 


  • // $resource = db_query($sql);  // -> old sentence without pager
  • $resource = pager_query($sql, $count); // -> pager


Then, we simple come back to the function that is called by our hook_menu, and we change:

archlinux and vbox: sharing folders

This days i'm discovering a new Linux flavour, which it remembers me a lot to another old friend: Gentoo. It has a really similar way of installing, it's very very customizable like Gentoo, and it's quite minimalistic. I'm speaking about Archlinux.

I have to say that this days I was thinking in changing from more than 3 or 4 idilic years with Debian/Ubuntu to a more customizable system. I really don't like the last change which Ubuntu has made on the Desktop, and I really loved when I had the possibility of using last releases of software when using Gentoo (5 or 6 years ago).


ERROR 2013 (HY000): Lost connection to MySQL server

Have you ever had a big (and when i say big I mean BIG) database which you need to import in a sql file?

If so, you'll probably have found this issue (or even you are having the problem just now and you are reading this looking for a solution):

ERROR 2013 (HY000): Lost connection to MySQL server

This uses to happen when trying to import the dump with the mysql -u command:

mysql -u root -p database < databasetoimport.sql


Upgrading two git repositories automatically

There is a simple way of upgrading or executing a command immediatly after a push has been done.

We just need to go to the server repository (the one which is going to receive the push), and enter in hooks (.git/hooks or hooks if it's a bare repository).

Then, we rename the post-receive.sample to post-receive, without extension, and add this content:

echo "********************"

echo "Post receive hook: Updating User Staging"

echo "********************"

cd ../live


git pull origin master


Capistrano config.rb

set :application, "bounty app"

#set :repository,  "localhost:/var/www/git/bountyrepo"

set :repository,  "localhost:/var/www/git/blessed"

set :scm, :git # You can set :scm explicitly or Capistrano will make an intelligent guess based on known version control directory names

# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`


Developing under Linux Apache in windows

Contradictory? Yes, a bit, but you cannot allways choose the systems and architecture in which you are working.

solution? Runing apache under linux instead of runing wamp or some weird solutions like that (i don't like at all, sorry).

First, install vbox:

Second, download the iso of your preffered linux distro, and install it.

Third, when you machine is running, go to Devices>install guest additions.