Mod_harbour and Mercury over Ubuntu/Linux VM

mod_harbour is an Apache module that allows to run PRGs directly on the web !!!
Post Reply
User avatar
ricbarraes
Posts: 49
Joined: Tue Jun 30, 2015 2:26 am
Location: Brazil

Mod_harbour and Mercury over Ubuntu/Linux VM

Post by ricbarraes »

Hey everybody!
for the last couple of days I've been struggling to configure and get mod_harbour and mercury running over a Ubuntu/Linux Virtual Machine using Oracle VirtualBox, but fortunately I made it!

I followed all the steps described in the github repo (https://github.com/FiveTechSoft/mod_har ... ster/linux) but I think there's some others steps missing (or maybe Ubuntu specifically requires it).

So now, let me explain how I got everything running after installing the Ubuntu VM in Oracle VirtualBox:

STEP 1: Install git

sudo apt-get install git-all

STEP 2: Install some linux packages

sudo apt install libcurl4-openssl-dev
sudo apt install libssl-dev
sudo cp -r /usr/include/x86_64-linux-gnu/curl /usr/include

STEP 3: Install apache

sudo apt install apache2
sudo apt install apache2-dev

STEP 4: Git clone mod_harbour github repository

git clone https://github.com/fivetechsoft/mod_harbour

STEP 5: Modify the read/write permissions from some directories

sudo chmod -R 777 /etc/apache2/
sudo chmod -R 777 /var/www/html/
sudo chmod -R 777 /usr/lib/x86_64-linux-gnu

** the first command allow me modify the apache2.conf file and others
** the second command allow me to create files and folders inside the /var/www/html (where our applications will be located)
** the third command allow me to read some important lib's required by my application

STEP 6: Let's move the files to the right directories (create references to the files)

cd /var/www/html
sudo ln -sf ~/mod_harbour/linux/libharbour.so.3.2.0 libharbour.so.3.2.0
sudo ln -sf ~/mod_harbour/samples modharbour_samples
cd /usr/lib/apache2/modules
sudo ln -sf ~/mod_harbour/linux/mod_harbour.so mod_harbour.so

STEP 7: Save/create the project inside the directory: /var/www/html

STEP 8: Mofidy the /etc/apache2/apache2.conf file

LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so
LoadModule harbour_module /usr/lib/apache2/modules/mod_harbour.so
<FilesMatch "\.(prg|hrb)$">
SetHandler harbour
</FilesMatch>
<Directory /var/www/html/project_name>
SetEnv APP_TITLE "project_name v0.1"
SetEnv PATH_URL "/project_name"
SetEnv PATH_APP "/project_name"
SetEnv PATH_DATA "/project_name/data/"
SetEnv PATH_MERCURY "/project_name/lib/mercury"
DirectoryIndex index.prg main.prg
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.prg/$1 [L]
</Directory>


** You only have to add the first line (LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so), if she was missing inside your apache2.conf file. this line loads the rewrite module so the RewriteEngine can work properly
** for every project you got running you need to create a <Directory> block with some especifications, there's no need to use .htaccess files. this practice increases apache performance (correct me if I'm wrong)

This is enough to get mod_harbour and mercury running properly!
Sds,
Ricardo Arraes
ricardo@vfatec.com.br
Post Reply