繁体   English   中英

运行 Python 程序时出现内部服务器错误

[英]Internal Server Error while running Python Program

I am running XAMPP on windows, and trying to run following python code and it is giving 500 Internal Server Error, when I checked error log it says:AH01909: www.example.com:443:0 server certificate does NOT include an ID which匹配服务器名称,[cgi:error] [pid 17416:tid 1836] (OS 5)访问被拒绝。 :[client::1:1031] AH01223:无法生成子进程:C:/xampp/htdocs/test.py

我的代码:#:C:/Users/Sravani/AppData/Local/Programs/Python/Python38-32 print ("Content-type:text/html\n") print ("") print ("") print ("第一个 CGI 程序") print ("") print ("") print ("

你好

") 打印 ("") 打印 ("")

谁能在这方面帮助我

您可能应该检查它是否是错误的位置

#:C:/Users/Sravani/AppData/Local/Programs/Python/Python38-32

使用我在此处发布的 install.bat: https://stackoverflow.com/a/71735909/5781320

in windows 10 x64+ apache + php 8.1 +... and python associated correctly i have in my htdocs a folder test where i have 2 files:

index.php

<?php

// Highest priority
proc_nice(-20);

//echo shell_exec('index.rb');
//system('index.rb');

echo shell_exec('index.py');
//system('index.py');


?>

index.py

打印('Python:你好,世界!')

通过在浏览器中调用 http://localhost/test/ 我运行了 python 脚本而不调用它 cgi (.#...)

我让您阅读的评论到位。

//echo shell_exec('index.rb');
//system('index.rb');

因为我什至有 ruby 和 index.rb 并且它们都运行。 (我不是 python 用户,也不是 ruby 但我通常会尝试他们两个 - 甚至 golang 看看有什么新的..)

索引.rb

#puts "Content-type: text/html\r\n"
puts "Ruby:Hello World" + "<br>"

time1 = Time.new
puts "Current Time : " + time1.inspect + "<br>"

# Time.now is a synonym:
time2 = Time.now
puts "Current Time : " + time2.inspect + "<br>"

在 ruby 中,无需关联您已经完成的任何操作(以防您损坏了您已修复的内容)

暂无
暂无

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

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