cPanel

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
    
     #!/usr/bin/python
    
   
XsoftHost Support

Share

Recent Posts

Add Extra IP addresses to server configuration On Ubuntu 17.10 and later

Each failover IP address will need its own line in the configuration file. The configuration…

4 years ago

Create RAID Arrays with mdadm on Ubuntu

What is mdadm? The mdadm utility can be used to create and manage storage arrays…

4 years ago

How to change the maximum upload file size for PHP

There are several scenarios that you might need to increase or decrease your php maximum…

6 years ago

How to install Let’s Encrypt Plugin in WHM/cPanel

What is Let’s Encrypt? Let’s Encrypt is a free certificate authority provided by the Internet…

6 years ago

How to install and enable GUI GNOME Desktop on centos 7

Usually CentOS 7 comes in a numbers of variants, For most users, there are two…

6 years ago

How to Uninstall cloudlinux and covert back to centos cpanel server

CloudLinux supports all the hardware supported by RHEL/CentOS, with few exceptions. Exceptions are usually hardware…

6 years ago