skip to Main Content

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/htmln")
print ("")
print ("")
print ("First CGI Program")
print ("")
print ("")
print ("

Hello

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

can anyone help me in this regard

2

Answers


  1. You should probably check if it’s the wrong location

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

    Login or Signup to reply.
  2. 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/htmlrn"
    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)

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search