简体   繁体   English

AH00526 在 Ubuntu 上使用 Apache 运行 python 时出错

[英]AH00526 Error while running python using Apache on Ubuntu

I was trying to run python, using Xampp-8.1.12 with Apache 2.4, since my project use python script.我试图运行 python,使用 Xampp-8.1.12 和 Apache 2.4,因为我的项目使用 python 脚本。 So I added the following lines to /opt/lampp/apache2/conf/httpd.conf :所以我将以下行添加到/opt/lampp/apache2/conf/httpd.conf

AddHandler cgi-script .py
ScriptInterpreterSource Registry-Strict

following the web tutorials.按照 web 教程进行操作。 But as I added the above and restarted Apache server it is not starting with following error:但是当我添加上面的内容并重新启动 Apache 服务器时,它没有启动并出现以下错误:

AH00526: Syntax error on line 12 of /opt/lampp/apache2/conf/httpd.conf:
Invalid command 'ScriptInterpreterSource', perhaps misspelled or defined by a module not included in the server configuration

I have python3 and python 2 both installed and I have mentioned in the file, I would like to run, that the file is to be run with python3.我安装了 python3 和 python 2,我在文件中提到,我想运行,该文件将使用 python3 运行。

错误的图片描述

You have to remove the ScriptInterpreterSource from your httpd.conf file, because it is not recognized by Apache and you get that error.您必须从httpd.conf文件中删除ScriptInterpreterSource ,因为 Apache 无法识别它,您会收到该错误。 Try using AddHandler so Apache runs the Python interpreter on your .py files.尝试使用AddHandler ,以便 Apache 在您的.py文件上运行 Python 解释器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM