簡體   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