logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Beginner apache issues
Author
awa5114



Joined: 19 Sep 2018
Posts: 1
Location: Delft, Netherlands

PostPosted: Wed 19 Sep '18 13:32    Post subject: Beginner apache issues Reply with quote

I am trying to get a simple web service running on my local computer. In my `cgi-bin` directory in the `Apache24` folder I added an empty file called `pywps.cgi` with the following content

#!C:\ProgramData\Anaconda2\envs\wps_env\python.exe
import sys
sys.path.insert(0, r"C:/pywps")
import os
os.environ['PYWPS_CFG']='C:/pywps/pywps.cfg'
os.environ['MPLCONFIGDIR']='C:/ProgramData/Anaconda2/envs/wps_env/Lib/site-packages/matplotlib/mpl-data'
# Note that WPS runs as apache user and not as you, so many more user variables might be needed.
# Restart Apache after adding one.
import pywps
The main `index.html` file works fine, but when i try to open `http://localhost/cgi-bin/pywps.cgi` I get an error:


> Internal Server Error The server encountered an internal error or
> misconfiguration and was unable to complete your request.
>
> Please contact the server administrator at admin@example.com to inform
> them of the time this error occurred, and the actions you performed
> just before this error.
>
> More information about this error may be available in the server error
> log

I checked the error log and I've got this going on:

[Wed Sep 19 10:36:25.173859 2018] [core:notice] [pid 11404:tid 476] AH00094: Command line: 'C:\\Apache24\\bin\\httpd.exe -d C:/Apache24'
[Wed Sep 19 10:36:25.191859 2018] [mpm_winnt:notice] [pid 11404:tid 476] AH00418: Parent: Created child process 8080
[Wed Sep 19 10:36:26.134859 2018] [mpm_winnt:notice] [pid 8080:tid 416] AH00354: Child: Starting 64 worker threads.
[Wed Sep 19 10:36:27.134859 2018] [mpm_winnt:notice] [pid 1520:tid 420] AH00364: Child: All worker threads have exited.
[Wed Sep 19 10:37:03.781859 2018] [cgi:error] [pid 8080:tid 976] [client ::1:54670] End of script output before headers: pywps.cgi

I have been looking all over for the `end of script output before headers` but I'm not sure what could be causing it. I checked and rechecked my `DocumentRoot` path and also the paths in the `cgi` file to no avail. Could anyone help please?

**EDIT**

I tried adding the following after setting the interpreter path:

print("Content-type: text/html\n\n")

Which seems to run the script with no issues but does not output the desired `xml`. Modifying the above `html` with `xml` throws an error:

> This page contains the following errors: error on line 2 at column 1:
> Extra content at the end of the document Below is a rendering of the
> page up to the first error.

Where line 2 contains the additional `print` statement shown above.
Back to top
admin
Site Admin


Joined: 15 Oct 2005
Posts: 692

PostPosted: Wed 19 Sep '18 14:50    Post subject: Reply with quote

Please use a meaningful subject, see forum rules.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7373
Location: Germany, Next to Hamburg

PostPosted: Tue 16 Oct '18 22:40    Post subject: Reply with quote

Check the line endings of the file. Some Interpreters can handle only Linux line endings.
Back to top


Reply to topic   Topic: Beginner apache issues View previous topic :: View next topic
Post new topic   Forum Index -> Apache