Making Python scripts work on MAMP?

To do this with CGI, I recommend reading the Python CGI docs At a minimum, you need to output the content type and html tags: print "Content-Type: text/html" print print "" print "" print "Example of Python CGI script" print "" print "" print " " print "" print.

To do this with CGI, I recommend reading the Python CGI docs. At a minimum, you need to output the content type and html tags: print "Content-Type: text/html" print print "" print "" print "Example of Python CGI script" print "" print "" print " " print "" print "" Also, make sure the web server software has permission to execute the script. You should be able to use chown to set the ownership and chmod to set the permissions.

Matt i'm very new to web applications can you please be more elobarative with how to run the commands. I'm using a MAMP server and my local host redirects to htdocs/. Where should I place the python file and how to run the chmod commands?

– Ravi Teja Feb 9 at 15:30 @Ravi Teja: I've never worked on MAMP; hopefully my Linux & WAMP experience suffices. Also, some of this is configuration dependent, so you may need to adjust the following for your system. Putting the script in /htdocs/cgi-bin should work, assuming that's what your server's configuration is set for.

Run chown & chmod from the command line; it's easiest to be in the same directory as the file. I recommend doing a chown apache:apache hello. Py to set the file's ownership to the webserver (assuming the server runs under user apache).

Then a chmod u+x to allow the program to be run. – GreenMatt Feb 9 at 15:49 Thanks for your quick reply, SO when I try running the chown command from the terminal going into the cgi-bin directory I got an error chown: apache: Invalid argument – Ravi Teja Feb 9 at 16:03 Unfortunately, this is difficult to diagnose via a forum - at least for me. A first guess is that the user which runs your server isn't called apache.

Figure out what user the server does run under and use that username. Alternatively, you could just chmod o+x hello. Py to make the file runnable by anyone.

That will allow you to test it. I've seen operational systems set to run that way. However, some people have security concerns with such a set up - if this is a development system and you're not allowing the outside world to see the site, it's probably not an issue.

– GreenMatt Feb 9 at 17:51 @GreenMatt How can I get the users using apache and for supppose if the user is root what command should I try chown root:apache hello. Py or chown apache:root hello. Py or chown root:root hello.Py – Ravi Teja Feb 97 at 4:55.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions