Setting a Linux server for Mod_harbour

Responder
Avatar de Usuario
ricardo arraes
Mensajes: 87
Registered for: 4 years
Brazil

Setting a Linux server for Mod_harbour

Mensaje por ricardo arraes »

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 other 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

Código: Seleccionar todo

sudo apt-get install git-all
STEP 2: Install some linux packages

Código: Seleccionar todo

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

Código: Seleccionar todo

sudo apt install apache2
sudo apt install apache2-dev
STEP 4: Git clone mod_harbour github repository

Código: Seleccionar todo

git clone https://github.com/fivetechsoft/mod_harbour
git clone https://github.com/carles9000/mercury
STEP 5: Modify the read/write permissions from some directories

Código: Seleccionar todo

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)

Código: Seleccionar todo

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

Código: Seleccionar todo

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!
The work always comes before the belief

Avatar de Usuario
charly
Mensajes: 145
Registered for: 4 years

Mensaje por charly »

Ricardo,

Thanks for your extensive explanation
Obrigado por sua extensa explicação :D
Salutacions, saludos, regards.
Charly

"...programar es fácil, hacer programas es difícil..."

https://httpd2.blogspot.com/
https://forum.modharbour.app

Maurizio
Mensajes: 2
Registered for: 3 years 11 months
Italy

Mensaje por Maurizio »

Good Morning,
after many months i am trying to use mod_harbour again, and i followed the notes to install in linux .
The only command that didn't work
sudo cp -r /usr/include/x86_64-linux-gnu/curl /usr/include
in fact the folder
/ usr / include / x86_64-linux-gnu / curl
is not in my linux

Anyway, when I now launch
http://192.168.0.253/info.prg
I have this error
mod_harbour version Jul 14 2020, 14:33:26
/tmp/libharbour.1099138944.513401075: cannot open shared object file: No such file or directory
failed to load hb_apache()
Thanks Maurizio

Avatar de Usuario
charly
Mensajes: 145
Registered for: 4 years

Mensaje por charly »

Ciao Maurizio,

Are you a windows or linux user?

I ask this because sometimes there are users who directly want to test the whole modharbour system with Linux but need a basic knowledge of the operating system.

In my case, I always develop in win64 and when I finish I can port it to linux just to check runtime differences. This is very easy.

Linux environment support is limited by very few users here, and I think the important thing really is that you can try and experiment with the mod regardless of the operating system.

Feel free to ask more about the topic.

C.
Salutacions, saludos, regards.
Charly

"...programar es fácil, hacer programas es difícil..."

https://httpd2.blogspot.com/
https://forum.modharbour.app

Maurizio
Mensajes: 2
Registered for: 3 years 11 months
Italy

Mensaje por Maurizio »

Ciao Charly,

I am a windows user , but for the web I use linux server.

I have developed several small applications with a RAD environment (Scriptcase) and I'd like to bring them to mod_harbour on serving linux .

If, as you say, if then bringing them to linux is simple, I can try to work with Windows.

Maurizio

Avatar de Usuario
charly
Mensajes: 145
Registered for: 4 years

Mensaje por charly »

Ciao Maurizio,

Yes, it is quite transparent. You only have to take into account small details, for example, if you use path to specify file paths, then you should always use "/" instead of "\". On windows you can use "/" without problems, for example /mypath/mydir/myfile.

For the rest more or less, all the code is quite transparent.

It is my advice for people who start in modharbour, because I know how complicated it is at the beginning and more so in linux system if one does not know how it works.

Anything, you tell us here

Cheers
Salutacions, saludos, regards.
Charly

"...programar es fácil, hacer programas es difícil..."

https://httpd2.blogspot.com/
https://forum.modharbour.app

Responder