Python Hello World程序错误,脚本不可执行

问题描述 投票:0回答:1

我正在尝试运行一个简单的Python Hello World脚本。我有通过命令行运行的程序,但是当我尝试从我们的网站运行该程序时却没有。我收到404未找到错误脚本请求无效。该脚本不可执行。我正在Apache Web服务器下也正在运行PHP的IBM AS400 ISeries上工作。

我添加了

Options +FollowSymLinks +ExecCGI
AddHandler cgi-script .py

到httpd.conf文件以为我的服务器打开Python。我正在运行的文件具有读取和执行权限。我将在下面发布当前的配置文件,这是我尝试运行的代码。

#!/QOpenSys/usr/bin/python3
print("Content-type: text/html\n");
print("\n\n");
print("<HTML>");
print("<HEAD>");
print("<TITLE>Test</TITLE>");
print("</HEAD>");
print("<BODY>");
print("<H2>Hi there.</h2>");
print("</BODY>");
print("</HTML>");

我仍在尝试弄清整个Python问题,我们将不胜感激。

谢谢。

配置:

# BMAServer Web Server Configuration created by MCCI/Chuck Mason on 2/13/2019
#LoadModule ibm_ssl_module /QSYS.LIB/QHTTPSVR.LIB/QZSRVSSL.SRVPGM

LoadModule zend_enabler_module /QSYS.LIB/QHTTPSVR.LIB/QZFAST.SRVPGM

Listen *:85

DocumentRoot /www/bmaserver/htdocs
TraceEnable Off

Options +Indexes +FollowSymLinks +ExecCGI

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%{Cookie}n \"%r\" %t" cookie
LogFormat "%{User-agent}i" agent
LogFormat "%{Referer}i -> %U" referer
LogFormat "%h %l %u %t \"%r\" %>s %b" common

CustomLog logs/access_log combined
LogMaint logs/access_log 3 0
LogMaint logs/error_log 3 0

ServerName BMAserver

SetEnvIf "User-Agent" "Mozilla/2" nokeepalive
SetEnvIf "User-Agent" "JDK/1\.0" force-response-1.0
SetEnvIf "User-Agent" "Java/1\.0" force-response-1.0
SetEnvIf "User-Agent" "RealPlayer 4\.0" force-response-1.0
SetEnvIf "User-Agent" "MSIE 4\.0b2;" nokeepalive
SetEnvIf "User-Agent" "MSIE 4\.0b2;" force-response-1.0

DirectoryIndex menu.php

CgiConvMode %%MIXED/MIXED%%
#TimeOut 30000
KeepAlive Off
HotBackup Off

DefaultFsCCSID 37
CGIJobCCSID 37

AccessFileName .htaccess
AddCharset UTF-8 .htm .html

# zend fastcgi
# Directive name "FastCgiConfig" is not recognized. (argh)
AddType application/x-httpd-php .php
AddHandler fastcgi-script .php

RewriteEngine on

<Location *>
  <LimitExcept GET HEAD OPTIONS TRACE POST>
     Order Allow,Deny
     Deny From All
  </LimitExcept>
</Location>

<Location />
  Require valid-user
  AuthType Basic
  AuthName MHBAServer
  PasswdFile %%SYSTEM%%
  UserID %%CLIENT%%
</Location>

<Directory />
  Order Deny,Allow
  Deny From all
</Directory>

# Allow requests for files in document root
<Directory /www/bmaserver/htdocs>
  Options +FollowSymLinks +ExecCGI
  AddHandler cgi-script .py
  Order Allow,Deny
  Allow From all
  AllowOverride all
</Directory>

# Allow requests for OutQueue
<Directory /www/bmaserver/OutQueue>
  Order Allow,Deny
  Allow From all
</Directory>

AliasMatch ^/htdocs/(.*) /www/bmaserver/htdocs/$1
AliasMatch ^/OutQueue/(.*) /www/bmaserver/OutQueue/$1
python apache ibm-midrange
1个回答
0
投票

您有没有找出问题所在?我遇到了同样的问题。

© www.soinside.com 2019 - 2024. All rights reserved.