cPanel Internal python
I am facing an issue porting an existing python plugin for cPanel to python3 . It looks like the cPanel part of the plugin always run on python2.7 ( default python on Centos7), irrespective of the fact that we add #!/usr/bin/python3 as the shebang line.
Now the WHM plugin part works pretty well and it respects the shebang line and works on python2 or python3
If I do on the script
[CODE=python]import sys
print (sys.version)
it always shows Python version 2.7.5 I am porting the plugin to python3 because CentOS8 comes with python3 as default and I do not want to maintain 2 pieces of code for CentOS7 and CentOS8 Is this is a limitation imposed by cPanel and if yes is there a way to override/change the python version in cpaneld NOTE: this is not about running a python app in apache, but a plugin in cpaneld ( the cpanel daemon)
it always shows Python version 2.7.5 I am porting the plugin to python3 because CentOS8 comes with python3 as default and I do not want to maintain 2 pieces of code for CentOS7 and CentOS8 Is this is a limitation imposed by cPanel and if yes is there a way to override/change the python version in cpaneld NOTE: this is not about running a python app in apache, but a plugin in cpaneld ( the cpanel daemon)
-
Hey there, cPsrvd is going to use the system version since it's compiled. If you run this on a CentOS 8 server with cPanel 92, are you able to run this under Python3? 0 -
Hi, No. I tested this in CentOS8 and cPanel v92 and it is still using python2 [CODE=bash]# # cat /etc/redhat-release CentOS Linux release 8.2.2004 (Core) # /usr/local/cpanel/cpanel -V 92.0 (build 0) # strings /usr/local/cpanel/cpsrvd|grep python python Could not locate a working python /usr/bin/python2 $python_bin
Are you going to keep this like this or will there be a shift to python3 sometime? Since cPanel itself does not rely on python, It would be great if there is some way the shebang line is honoured and users can choose the python interpreter for cpsrvd too0 -
From the RHEL8/CentOS-8 release notes Dynamic programming languages, web and database servers Python 3.6 is the default Python implementation in RHEL 8; limited support for Python 2.7 is provided. No version of Python is installed by default. It seems CentOS-8 offers only limited support for python2 ( note it's being sunsetted for almost 1 year now). I do find many python2-xxx module RPM's missing in CentOS8 It could be installed via pip, but won't be a neat solution. 0 -
Ok, I read it up. Luckily I could just ship a few extra python modules as RPM in my repository and have the code run in python2 in Centos8. So hopefully it is a smooth transition for me 0
Please sign in to leave a comment.
Comments
5 comments