Migration to the new mod_harbour fastCGI
- Massimo Linossi
- Posts: 474
- Joined: Mon Oct 17, 2005 10:38 am
- Location: Italy
Re: Migration to the new mod_harbour fastCGI
Thanks a lot my friend.
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Migration to the new mod_harbour fastCGI
Massimo,
Ready!
server (EXE):
https://github.com/FiveTechSoft/mod_har ... /win64/ADS
fastCGI mod:
https://github.com/FiveTechSoft/mod_har ... d_fcgid.so
Ready!
server (EXE):
https://github.com/FiveTechSoft/mod_har ... /win64/ADS
fastCGI mod:
https://github.com/FiveTechSoft/mod_har ... d_fcgid.so
- Massimo Linossi
- Posts: 474
- Joined: Mon Oct 17, 2005 10:38 am
- Location: Italy
Re: Migration to the new mod_harbour fastCGI
Hi Antonio.
I've installed the new mod-harbour fcgi but I have an error.
The compiled prg seem not loaded.
This is the main.prg made for testing:
The retedb.prg contains 2 functions :
But the I try to run the main.prg I have this error :
With the previous mod-harbour the program runs without problems.
What could be wrong ?
Thanks a lot.
Massimo
I've installed the new mod-harbour fcgi but I have an error.
The compiled prg seem not loaded.
This is the main.prg made for testing:
Code: Select all
// {% LoadHRB( "retedb.hrb" ) %}
memvar hForm
**************************************************************************
Function main()
local mv_username:="" , mv_password:="" , nErr:=0 , zMail:="" , cUserName:=""
local link_intra:="" , pagina_arrivo:="" , controllo_web:=""
local cookie_stringa
Setting_db()
SetCookie( 'blu1', "cookie numero 1" + "|" + "2020|1|1|", 90000, '' )
SetCookie( 'blu2', "cookie numero 2" + "|" + "2020|2|2|", 90000, '' )
SetCookie( 'blu3', "cookie numero 3" + "|" + "2020|3|3|", 90000, '' )
SetCookie( 'blu4', "cookie numero 4" + "|" + "2020|4|4|", 90000, '' )
SetCookie( 'blu5', "cookie numero 5" + "|" + "2020|5|5|", 90000, '' )
SetCookie( 'blu6', "cookie numero 6" + "|" + "2020|6|6|", 90000, '' )
SetCookie( 'blu7', "cookie numero 7" + "|" + "2020|7|7|", 90000, '' )
SetCookie( 'blu8', "cookie numero 8" + "|" + "2020|8|8|", 90000, '' )
Return nil
**************************************************************************
function msgAlert( cMsg )
? "<script>alert('"+cMsg+"');</script>"
Return nil
Code: Select all
**************************************************************************
Function BLR(wait) // BLOCCA IL RECORD
** wait = i secondi di attesa dopodiche' la funzione ritorna .F.
** se non riesce ad aprire il file
local forever
IF RLOCK()
Return .T.
ENDIF
forever=(wait=0)
Do while ( forever .or. wait > 0 )
SecondsSleep(1)
wait-=0.50
IF RLOCK()
Return .T.
ENDIF
IF INT(wait) = wait
EXIT
ENDIF
Enddo
Return .F.
**************************************************************************
Function Setting_db()
REQUEST HB_LANG_IT
HB_LANGSELECT("IT")
REQUEST DBFCDX
REQUEST DBFFPT
REQUEST ADS
RddRegister( "ADS", 1 )
RddSetDefault("ADS")
SET SERVER REMOTE
SET FILETYPE TO ADT
SET(_SET_AUTORDER,1)
SET AUTOPEN ON
set(_SET_OPTIMIZE,.T.)
ADSLOCKING(.T.)
SET DATE BRITISH
SET DELETED ON
SET CENTURY ON
Return nil
Code: Select all
Error: Undefined function
operation: SETTING_DB
called from: pcode.hrb, SETTING_DB, line: 0
called from: pcode.hrb, MAIN, line: 12
called from: HB_HRBDO, line: 0
called from: ..\source\exec.prg, EXECUTE, line: 70
Source:
0010: local cookie_stringa
0011:
0012 =>Setting_db()
0013:
0014: SetCookie( "blu1", "cookie numero 1" + "|" + "2020|1|1|", 90000, "" )
What could be wrong ?
Thanks a lot.
Massimo
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Migration to the new mod_harbour fastCGI
Massimo,
Please have all the source code in one single PRG file.
Try it without HRB files (for now)
many thanks for your feedback
Please have all the source code in one single PRG file.
Try it without HRB files (for now)
many thanks for your feedback
- Massimo Linossi
- Posts: 474
- Joined: Mon Oct 17, 2005 10:38 am
- Location: Italy
Re: Migration to the new mod_harbour fastCGI
Antonio,
tested with everything inside one prg without HRB and it's working.
But I cannot convert a big procedure in FastCGI that is made of several prg and 4 HRB files.
I wait for your future suggestions.
Thanks a lot.
Massimo
tested with everything inside one prg without HRB and it's working.
But I cannot convert a big procedure in FastCGI that is made of several prg and 4 HRB files.
I wait for your future suggestions.
Thanks a lot.
Massimo
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Migration to the new mod_harbour fastCGI
Massimo,
Please use this function MyLoadHRB() and change the value 1 (twice in the code) from 1 up to 4 and check
if with some of those values it works as expected, many thanks
Please use this function MyLoadHRB() and change the value 1 (twice in the code) from 1 up to 4 and check
if with some of those values it works as expected, many thanks
Code: Select all
function MyLoadHRB( cHrbFile_or_oHRB )
local lResult := .F.
if ValType( cHrbFile_or_oHRB ) == "C"
if File( hb_GetEnv( "PRGPATH" ) + "/" + cHrbFile_or_oHRB )
AAdd( M->getList,;
hb_HrbLoad( 1, hb_GetEnv( "PRGPATH" ) + "/" + cHrbFile_or_oHRB ) )
lResult = .T.
endif
endif
if ValType( cHrbFile_or_oHRB ) == "P"
AAdd( M->getList, hb_HrbLoad( 1, cHrbFile_or_oHRB ) )
lResult = .T.
endif
return lResult
- Massimo Linossi
- Posts: 474
- Joined: Mon Oct 17, 2005 10:38 am
- Location: Italy
Re: Migration to the new mod_harbour fastCGI
Hi Antonio.
I put your function at the end of the prg and wrote this line at the beginning :
But when I run the prg I receive this error :
I put your function at the end of the prg and wrote this line at the beginning :
Code: Select all
// {% MyLoadHRB( "retedb.hrb" ) %}
Code: Select all
Error: Undefined function
operation: MYLOADHRB
[ 1] = C retedb.hrb
called from: pcode.hrb, MYLOADHRB, line: 0
called from: ..\source\exec.prg, (b)REPLACEBLOCKS, line: 143
called from: ..\source\exec.prg, REPLACEBLOCKS, line: 143
called from: ..\source\exec.prg, EXECUTE, line: 63
Source:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Migration to the new mod_harbour fastCGI
Massimo,
Please download modharbour.exe from here:
https://github.com/FiveTechSoft/mod_har ... arbour.exe
And try to use LoadHRB() as usual
many thanks for your very valuable feedback
Please download modharbour.exe from here:
https://github.com/FiveTechSoft/mod_har ... arbour.exe
And try to use LoadHRB() as usual
many thanks for your very valuable feedback
- Massimo Linossi
- Posts: 474
- Joined: Mon Oct 17, 2005 10:38 am
- Location: Italy
Re: Migration to the new mod_harbour fastCGI
Antonio,
this is the hrb file
And this the simple prg
Running this simple prg I have this error
this is the hrb file
Code: Select all
Function Setting_db()
REQUEST HB_LANG_IT
HB_LANGSELECT("IT")
REQUEST DBFCDX
REQUEST DBFFPT
REQUEST ADS
RddRegister( "ADS", 1 )
RddSetDefault("ADS")
SET SERVER REMOTE
SET FILETYPE TO ADT
SET(_SET_AUTORDER,1)
SET AUTOPEN ON
set(_SET_OPTIMIZE,.T.)
ADSLOCKING(.T.)
SET DATE BRITISH
SET DELETED ON
SET CENTURY ON
Return nil
*****************************************************************************
function SetCookie( cName, cValue, nSecs, cPath, cDomain, lHttps, lOnlyHttp )
local cCookie := ''
hb_default( @cName, '' )
hb_default( @cValue, '' )
hb_default( @nSecs, 86400 )
hb_default( @cPath, '/' )
hb_default( @cDomain , '' )
hb_default( @lHttps, .F. )
hb_default( @lOnlyHttp, .F. )
cCookie += cName + '=' + cValue + ';'
if nSecs # 0
cCookie += 'max-age=' + alltrim(str( nSecs )) + ';'
endif
if !empty(cPath)
cCookie += 'path=' + cPath + ';'
endif
MH_Header( "Set-Cookie", cCookie )
return nil
*********************
function GetCookies()
local hHeadersIn := MH_HeadersIn()
local cCookies := If( hb_HHasKey( hHeadersIn, "Cookie" ), hb_hGet( hHeadersIn, "Cookie" ), "" )
local aCookies := hb_aTokens( cCookies, ";" )
local cCookie, hCookies := {=>}
for each cCookie in aCookies
hb_HSet( hCookies, SubStr( alltrim(cCookie), 1, At( "=", alltrim(cCookie) ) - 1 ),;
SubStr( alltrim(cCookie), At( "=", alltrim(cCookie)) + 1 ) )
next
return hCookies
Code: Select all
// {% LoadHRB( "retedb.hrb" ) %}
**************************************************************************
Function main()
Setting_db()
SetCookie( 'blu1', "cookie numero 1", 90000 )
Return nil
Code: Select all
Errore del server!
Il server ha generato un errore interno e non è in grado di soddisfare la richiesta.
Messaggio di errore:
malformed header from script 'test_cookie.prg': Bad header: Set-Cookie
Se pensi che questo sia un errore del server, per favore contatta il webmaster.
Error 500
localhost
Apache/2.4.39 (Win64) OpenSSL/1.0.2s PHP/7.1.30 mod_fcgid/2.3.9
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Migration to the new mod_harbour fastCGI
ok, we are checking it. thanks!
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Migration to the new mod_harbour fastCGI
Massimo,
Please remove the functions SetCookie() and GetCookies() from your HRB file, build it and try it again
many thanks
Please remove the functions SetCookie() and GetCookies() from your HRB file, build it and try it again
many thanks
- Massimo Linossi
- Posts: 474
- Joined: Mon Oct 17, 2005 10:38 am
- Location: Italy
Re: Migration to the new mod_harbour fastCGI
Hi Antonio.
This is the prg, with the Setcookie function (taken from the samples) inside the prg
and this is the result
This is the prg, with the Setcookie function (taken from the samples) inside the prg
Code: Select all
Function main()
SetCookie( 'blu', "cookienumber1" )
Return nil
function SetCookie( cName, cValue, nSecs, cPath, cDomain, lHttps, lOnlyHttp )
local cCookie := ''
// check parameters
hb_default( @cName, '' )
hb_default( @cValue, '' )
hb_default( @nSecs, 3600 ) // Session will expire in Seconds 60 * 60 = 3600
hb_default( @cPath, '/' )
hb_default( @cDomain , '' )
hb_default( @lHttps, .F. )
hb_default( @lOnlyHttp, .F. )
// we build the cookie
cCookie += cName + '=' + cValue + ';'
cCookie += 'expires=' + CookieExpire( nSecs ) + ';'
cCookie += 'path=' + cPath + ';'
cCookie += 'domain=' + cDomain + ';'
// pending logical values for https y OnlyHttp
// we send the cookie
MH_Header( "Set-Cookie", cCookie )
return nil
//----------------------------------------------------------------//
// CookieExpire( nSecs ) builds the time format for the cookie
// Using this model: 'Sun, 09 Jun 2019 16:14:00'
function CookieExpire( nSecs )
local tNow := hb_datetime()
local tExpire // TimeStampp
local cExpire // TimeStamp to String
hb_default( @nSecs, 60 ) // 60 seconds for this test
tExpire = hb_ntot( ( hb_tton( tNow ) * 86400 - hb_utcoffset() + nSecs ) / 86400 )
cExpire = cdow( tExpire ) + ', '
cExpire += AllTrim( Str( Day( hb_TtoD( tExpire ) ) ) ) + ;
' ' + cMonth( tExpire ) + ' ' + AllTrim( Str( Year( hb_TtoD( tExpire ) ) ) ) + ' '
cExpire += AllTrim( Str( hb_Hour( tExpire ) ) ) + ':' + AllTrim( Str( hb_Minute( tExpire ) ) ) + ;
':' + AllTrim( Str( hb_Sec( tExpire ) ) )
return cExpire
Code: Select all
Errore del server!
Il server ha generato un errore interno e non è in grado di soddisfare la richiesta.
Messaggio di errore:
malformed header from script 'test_cookie.prg': Bad header: Set-Cookie
Se pensi che questo sia un errore del server, per favore contatta il webmaster.
Error 500
localhost
Apache/2.4.39 (Win64) OpenSSL/1.0.2s PHP/7.1.30 mod_fcgid/2.3.9
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Migration to the new mod_harbour fastCGI
Massimo,
function SetCookie() and CookieExpire() are already inside modharbour.exe
thats why I am asking you to remove them from your code, thanks
function SetCookie() and CookieExpire() are already inside modharbour.exe
thats why I am asking you to remove them from your code, thanks
- Massimo Linossi
- Posts: 474
- Joined: Mon Oct 17, 2005 10:38 am
- Location: Italy
Re: Migration to the new mod_harbour fastCGI
Antonio,
sorry, I misunderstood your advice. I was thinking that I must remove that functions from the HRB and place them in the prg.
I've removed them and now everything seems to work correctly. I'll make some more tests. And the speed is really better.
You must change the name in Fivetech & Furious
sorry, I misunderstood your advice. I was thinking that I must remove that functions from the HRB and place them in the prg.
I've removed them and now everything seems to work correctly. I'll make some more tests. And the speed is really better.
You must change the name in Fivetech & Furious
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Migration to the new mod_harbour fastCGI
Massimo,
great!
thanks so much for your great feedback
great!
thanks so much for your great feedback