How to install python in my cPanel and add py extension

Python normally installed on all cPanel hosting server because most of Centos/red hat update system use it.

For python apache python extension ,you only needs to activate the python handler for your apache to allow the apache server serve the py file and execute it instead of send the script to the browser as downloadable file.

What is Python:

Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together.. 

Python’s design philosophy emphasizes code readability with its notable use of significant indentation. 

Its language constructs and object-oriented approach aim to help programmers write clear, logical code for small and large-scale projects.

How to add python apache python extension Handler from your cPanel account

  • Login to your cPanel account
  • From Advance group click Apache Handlers link.
  • On create Apache Handler add the Handler cgi-script ,and in extensions add .py extension the click Add ,This will create user defined Apache Handlers.
  • Then ,change the permissions for any python file to 755 ,this permissions need it in order for suexec to execute the files.
  • In yor python .py files you can use the following #!/usr/bin/python
Share on facebook
Share on twitter
Share on linkedin
Share on telegram
Share on whatsapp

Related Posts