XAMPP is one of the greatest (i.e most useful) bundled open-source packages that gives an easy, rich LAMP installation in seconds.

If you have tried it, you know that installing many different PHP extensions is neither easy nor fun on Linux. Well, except, maybe on Debian/Ubuntu where you can easily add components with apt-get. Alas, a lot of corporate production systems run RedHat and there XAMPP comes as real life-saver.

One thing about XAMPP though - it installs a whole bunch of stuff like Apache, PHP, MySQL, Proftpd, Webmin etc. I never use or enable FTP because I think it is insecure, legacy protocol that should never be used. Use SSH instead. As for MySQL, I like to install it myself from official MySQL binary distribution. It\’s a database server, hence - tricky and needs more attention than a vanilla installation. At least - that is my taste.

So, how do we disable FTP, MySQL and WebMin in XAMPP installation and use it only for Apache/PHP/Perl (we could install Python add-on, too) ?

It is actually, very easy. This is what you need to do:

  1. Edit /opt/lampp/lampp script. In start,stop and reload options comment-out everything except apache-related calls.
  2. Copy /opt/lampp/lampp script to /etc/init.d/httpd to make sure it start during operating system startup. Do not forget to put symlinks in default runlevels.
  3. Default XAMPP PHP installation will try to use default MySQL installation\’s socket and since we want to use “our” MySQL and do not even start XAMPP MySQL, will be unable to connect. To fix this, edit /opt/lamp/etc/php.ini and change the appropriate line to read:

     mysql.default_socket = /var/lib/mysql/mysql.sock
    

    whereas /var/lib/mysql/mysql.sock is the location of socket file for your custom MySQL installation.

Enjoy

Special note for all Drupal users out there: Drupal is known to have sesion problems on PHP5 in some configurations. Due to the problem, Drupal will keep logging you out at every page request. It has been reported for XAMPP/PHP5 (default config), too. If you intend to use XAMPP for Drupal, at least for the time being, we recommend to switch to PHP4. To do so just run once:

 /opt/lampp/lampp php4