How to create a batch file to run apache for API calls from Lectora

lbryan-4843
lbryan-4843 Community Member Posts: 12 ☆ Roadie ☆
I have several APIs being called from Lectora which require apache and I am using XAMPP. To start apache without user intervention, I have a batch file:
@echo off
set START_SERVER="C:\xampp\apache\bin\httpd.exe"
call %START_SERVER%

However, the httpd.exe command window remains open on to on the screen. I have tried the -k after the httpd.exe and nothing.

Does anyone have a suggestion or have done something similar?
Thanks.
Tagged:

Answers

  • CarlJFink
    CarlJFink Community Member, Lectora® Accessibility Group (LAUG) Member, eLearning Brothers® Partner Posts: 67 ☆ Superstar ☆
    Why are you running Apache locally? Unless you're creating an Apache course, that seems odd. The normal model is for Apache to run on the server.

    Doesn't this model assume the learner has Apache installed on their computer?

    If you mean that the batch file is on the server ... why would you start Apache from a batch file? It should always be running, unless (again) this is a very weird use case.
  • lbryan-4843
    lbryan-4843 Community Member Posts: 12 ☆ Roadie ☆
    Hi Carl,
    I have a Lectora title that runs offline (in a tablet) and js in actions call APIs to read and write data into SQLite. The APIs are in php so I have installed XAMPP to run Apache for the APIs to work.

    Apache is install in the tablet and I just need to start XAMMP Apache when the tablet is powered up, and thus the batch file. Everything runs except that the batch code keeps the command window open.

    I would like: tablet powers up, batch file is run at start-up, Apache runs, all cmd windows close, and the app open.

    Is the closing of the cmd window possible? I don't want the user to have to close it.
  • CarlJFink
    CarlJFink Community Member, Lectora® Accessibility Group (LAUG) Member, eLearning Brothers® Partner Posts: 67 ☆ Superstar ☆
    I have never used Apache on a Windows tablet. If it were Linux, I would at least be able to experiment, but I never use Windows on my personal equipment and I can't install Apache on my corporate laptop, so ....

    I stand by my conclusion that this is a very unusual use case. :)
  • lbryan-4843
    lbryan-4843 Community Member Posts: 12 ☆ Roadie ☆
  • lbryan-4843
    lbryan-4843 Community Member Posts: 12 ☆ Roadie ☆
    ...I got it working by placing a .vbs in the startup folder which starts apache...works pretty clean...
    Thanks for your help and guidance.
  • CarlJFink
    CarlJFink Community Member, Lectora® Accessibility Group (LAUG) Member, eLearning Brothers® Partner Posts: 67 ☆ Superstar ☆
    Sound as if my original idea was vaguely in the right area--Apache should start with the operating system initialization, or at least with user login.

    Glad you got it working.