AnsweredAssumed Answered

ArcGIS cannot run on Apache 2.4 + CGI

Question asked by nghiep_neolab on Nov 14, 2017
Latest reply on Nov 15, 2017 by nghiep_neolab

Hi everybody,

I try to use Arcpy on Apache 2.4 and CGI that is basic example. But I can't, It always display error message like "Not signed into Portal".

Although I signed in
I signed in

And then, I check about Licensing
Authorize ArcGIS Pro to work offline

 

So, ArcGIS configuration is ok.

 

Now I show you see what Apache configuration

- httpd.conf, I have enabled LoadModule cgi_module modules/mod_cgi.so

- ViltualHost, 

Apache Virtualhost configuration

=> I checked, VirtualHost works well without use Arcpy.

Apache Service is running
Apache 2.4 is running

Python example script

Python script withou arcpy

The result

It works well without arcpy

 

But When I import Arcpy in my Python script, It has the problem.

The bellowing is apache-cgi-example.py content

#!C:/Program Files/ArcGIS/Pro/bin/Python/envs/arcgispro-py3/python.exe
# coding: utf-8
print("Content-type: text/html\n\n")
print("")
print("<h2>ArcGIS runs on Apache 2.4 + CGI</h2>")

import sys, os
import bottle

import cgitb
cgitb.enable()

realpath = os.path.dirname(os.path.realpath(__file__))
sys.path.append(realpath)

print("<p><b>Project path</b>: {}</p>".format(str(realpath)))

app = bottle.default_app()
app.config.load_config("%s\\app.conf" % realpath)

try:
    print("<p><b>Output path</b>: {}</p>".format(str(app.config['app.output_path'])))

    import arcpy

    # Arcpy can overwrite output
    arcpy.env.overwriteOutput = True

    # set workspace dir
    arcpy.env.workspace = app.config['app.output_path']

    # initiation for volume calculation
    arcpy.CheckOutExtension("3D")
    arcpy.CheckOutExtension("spatial")

except Exception as error:
    print("<p><b>Cannot import Arcpy. Error</b>: {}</p>".format(str(error)))

 

The problem is "Not signed into Portal"

The page content is 

The problem

Can your please help me?

Thank many help!

 

Note:

- It has the same problem on IIS environment

- I am using ArcGIS Pro version 1.3 (Python version 3.4.4) 64bit

- I am using Apache 2.4.23  64bit

Outcomes