How to set up XAMPP 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 htdocs directory in xampp.
Xampp Version 5.6.30
Link to Python
Link to XAMPP
Should be the same versions as mine in order to work.
Make sure to save Python as C:Python3.6 using custom installation.First line of your program must direct to where python.exe is installed.Mine is #!C:/Python3.6/python.exe .You must use parenthesis with print.
1.Install xampp and python, make sure to remember the location where everything is installed.Mine are in 1 folder.
2.When both are installed, run XAMPP.
3.add test files to htdocs mine are downloadable.
4.Open the httpd.conf file in apache by clicking config but do not start apache yet.
6. Look for AddHandler cgi-script .cgi .pl .asp and add .py to it
8. open a browser, type localhost and go to it. This is your homepage.
9. To run your files type localhost/ enter in name of file. eg
10. 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.6/python.exe
11. You now should add passwords and run it offline if needed.
12.Python files need print(“content-type: text/htmlnn” ) below shebang in order to work.
my httpd file :
Python test program :
Php test program :
Program to run in idle to find path for shebang. Just add #! before it and double check it says python or python.exe if not just change it to the result of idle program.
Xem thêm Bài Viết:
- MDM là gì??? – Làm thế nào để tắt được MDM trên Macbook | Mẹo Vặt Macbook
- Người lao động nghỉ bị trừ lương || Tư vấn luật lao động
- Learn Emmet In 15 Minutes – Double Your HTML Coding Speed
- Giang Hồ Thanh Toán Nhau Trên Phố – Tập 4 – Giang Hồ Bắn Giết Nhau Trên Đường | Big Bang
- Lập trình Android A-Z – Bài 159: Fragment Create and add XML