oldteacher
Active member
Is there a way to change the port of http server dynamically with scripting?
Would be very useful to avoid conflicts.
Would be very useful to avoid conflicts.
I think we have a miscommunication.Sure, you can do that with HEScript. There is a code sample here about how to do it:
![]()
PHP Settings - External HTTP Server - ExeOutput for PHP
Learn how to configure and use an external HTTP server in your ExeOutput for PHP application, allowing access from a web browser.www.exeoutput.com
procedure StartMyHTTPServer;
var
portStr: string;
portNum: integer;
begin
portStr := GetGlobalVar('SelectedPort', '8142');
portNum := StrToIntDef(portStr, 8142);
StartHTTPServer(portNum);
ShowMessage('Server started on port ' + IntToStr(portNum));
end;
procedure StopMyHTTPServer;
begin
StopHTTPServer;
ShowMessage('Server stopped.');
end;
procedure StartMyHTTPServer;
var
portStr: string;
portNum: integer;
begin
// Read the port number from a global variable set by JavaScript
portStr := GetGlobalVar('SelectedPort', '8142');
portNum := StrToIntDef(portStr, 8142);
StartHTTPServer(portNum);
ShowMessage('Server started on port ' + IntToStr(portNum));
end;
procedure StopMyHTTPServer;
begin
StopHTTPServer;
ShowMessage('Server stopped.');
end;
procedure StartMyHTTPServer;
var
portStr: string;
portNum: integer;
begin
portStr := GetGlobalVar('SelectedPort', '8142');
ShowMessage('SelectedPort = "' + portStr + '"'); // debug
portNum := StrToIntDef(portStr, 8142);
StartHTTPServer(portNum);
ShowMessage('Server started on port ' + IntToStr(portNum));
end;
We use essential cookies to make this site work, and optional cookies to enhance your experience.