简体   繁体   中英

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 matches the server name, [cgi:error] [pid 17416:tid 1836] (OS 5)Access is denied. : [client::1:1031] AH01223: couldn't spawn child process: C:/xampp/htdocs/test.py

My code: #:C:/Users/Sravani/AppData/Local/Programs/Python/Python38-32 print ("Content-type:text/html\n") print ("") print ("") print ("First CGI Program") print ("") print ("") print ("

Hello

") print ("") print ("")

can anyone help me in this regard

You should probably check if it's the wrong location

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

use install.bat i posted here: 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');


?>

and index.py :

print('Python:Hello, World!')

by calling in browser http://localhost/test/ i got running the python script without calling it cgi (.#...)

i let in place the comments you read..

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

cause i have even ruby and the index.rb and they running both. (i am not python user and neither ruby but i usually for a while i try both of them -even golang to see what's new..)

the index.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>"

in ruby is no need to associate nothing you have already all done(in case you corrupt that you fix with this)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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