Yearly Archives: 2012


C/C++: An interresting macro to capture errors with perror, use custom error code number

#include <stdio.h>
#include <errno.h>
#define handle_error_ern(ern, msg) do { errno = ern; perror(msg); exit(EXIT_FAILURE); } while (0

Usage Example: handle_error_ern(s, “pthread_getaffinity_np”);


Ubuntu Linux: How to install Apache2 – MySQL – PHP (LAMP) phpMyAdmin and fix a few installation errors

We won’t give out pretty much any comments/descriptions for this post because we want to keep it small 🙂

First, install a bunch of stuff:

sudo apt-get install apache2
sudo apt-get install mysql-server
sudo apt-get install php5 libapache2-mod-php5 php5-mysql

Later, restart your apache so that it loads all modules (php, etc)

sudo /etc/init.d/apache2 restart

and if you get the following error:
“Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName” resolve it by adding the line:

ServerName localhost

to the file /etc/apache2/httpd.conf and then try restarting again. (You need root access to edit, if you are not familiar with command line text editors line nano, try sudo gedit /etc/apache2/httpd.conf, gedit is usually available with all gnome installations).

After that, to install phpMyAdmin and make it available at http://localhost/phpmyadmin:

sudo apt-get install phpmyadmin
sudo ln -s /usr/share/phpmyadmin /var/www

(The default MySQL login username ‘root’ and the password is the one you entered during installation in the last step).

Happy developing, hope we helped 🙂