Install WAMP server to run python , cgi-bin , PHP , scripts

 Install WAMP + PYTHON Integration



How to set up wamp to run Python programs and php on your own computer. SQL works also. Only tested on windows 10.All programs can be run through localhost in browser and files stored in www directory in wamp.
Wamp Version 3.0.6
Python.3.9.1
Link to Python
https://www.python.org/downloads/ Link to Wamp http://www.wampserver.com/en/download... Should be the same versions as mine in order to work. Make sure to save Python as C:\Python3.9.1 using custom installation. First line of your program must direct to where python.exe is installed. Mine is #!C:\Python3.9.1/python.exe .You must use parenthesis with print. Instructions: __________________________________________________________________ 1.Install wamp and python, make sure to remember the location where everything is installed.Mine are in 1 folder. 2.When both are installed, run wamp. 3.Go to wamp icon in tray, apache,httpd.conf. 4.Open the httpd.conf file. 5.In (Directoy /) change require all denied to require all granted. 6. Look for Options +Indexes +FollowSynsLinks........ and add +ExecCGI to that line. 7.Look for AddHandler cgi-script .cgi and add .py to it 8.Restart wamp 9.Go to www folder located in wamp where you installed yours. 10.Add files you want to run to that www folder. 11.I have two test files which you can add if needed. 12. open a browser, type localhost and go to it. This is your homepage. 13. To run your files type localhost/ enter in name of file. eg localhost/hello.py 14. That's it, it should work. Just make sure to have correct shebang on top of python files which shows the location of where python.exe is.

Mine is #!C:/Python3.9.1/python.exe
15. You now should add passwords and run it offline if needed. Python test program :

#!C:/Python3.9.1/python.exe
print("content-type: text/html\n\n" )
print("<br><B>hello python</B>")


Comments

Popular posts from this blog

Python to automate What's App messages

Building RESTful APIs with Flask in PyCharm

Redirecting to another page with button click in Python-flask