How to run python script in xampp on macOS

Ishika Tailor
Jun 15, 2021

--

Well, I was facing Error 500 to run python file on xampp. In this blog i will show you how you can run python file on xampp server. Let’s get started.

Step: 1 Install Xampp

Step: 2 Change configuration file

Edited httpd.conf

Click on configure
#add .py extension
AddHandler cgi-script .cgi .pl .asp .py

Start apache web server again.

Step : 3 Create your xyz.py python file. In terminal, Go to your file path and apply below command.

chmod 755 xyz.py

Ishika directory contains xyz.py file

Step: 4 Find python path

Go to finder, and type ctrl+shift+G.

Enter path: usr/local/bin

choose your python path: /usr/bin/python

Step: 5 Enter python path in xyz.py file

Make sure you add blank print statement before executable code. [print “”]

Step: 6 Error is solved

--

--

Ishika Tailor
Ishika Tailor

Written by Ishika Tailor

23 | Software Engineer @HSBC | Writing about Java and Design Patterns

No responses yet