• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Noam Harel

Regular Pleskian
Hi

i would like to install python and run .py scripts in httpdocs, also i have read here, that this is possible through plesk onyx.

so what would be the best practice to install python on centos 7 and make it competable with plesk onyx. detailed instruction if possible.

thank's in advance
Noam
 
Just install mod_python components with

# plesk installer --select-release-current --install-component mod_python

And enable it in Service Plan Hosting Settings:

Снимок экрана 2016-11-23 в 11.33.31.png
 
Mak sure that Python scripting engine is enabled here - Tools & Settings > Apache Web Server > check python.
 
thanks again for the quick answer!

the python scripting engine doesn't appear at all at: Tools & Settings > Apache Web Server > python:
python.png


for further information, after donig what you have wrote in your first message (plesk installer --select-release-current --install-component mod_python) the result was:
You already have the latest version of product(s) and all the selected components
installed. Installation will not continue.

server information:
Plesk Onyx v17.0.17_build1700161028.14 os_CentOS 7

Noam
 
What is output of commands:

# rpm -q mod_python
# httpd -M | grep python
 
i see the problem now:
[root@webnext ~]# rpm -q mod_python
package mod_python is not installed

[root@webnext ~]# httpd -M | grep python
[Wed Nov 23 11:03:54.495789 2016] [so:warn] [pid 8797] AH01574: module actions_module is already loaded, skipping
[Wed Nov 23 11:03:54.498570 2016] [so:warn] [pid 8797] AH01574: module headers_module is already loaded, skipping
[Wed Nov 23 11:03:54.498890 2016] [so:warn] [pid 8797] AH01574: module logio_module is already loaded, skipping
[Wed Nov 23 11:03:54.500298 2016] [so:warn] [pid 8797] AH01574: module suexec_module is already loaded, skipping
 
Strange why mod_python is not installed? Try to install it again through Tools&Settings->Update and Upgrade->etc...
 
Well, as I was informed, mod_python is not included to Plesk installer on modern OSes like Debian8, Centos7, Ubuntu16. My test Plesk Onyx server is based on Centos6.8 therefore I see mod_python in Plesk installer.
By default, Python is handled by FastCGI (mod_fcgid module). For Python, it is also possible to use Application server (this option is described in this article)
 
Hi igor this sounds weird, as this manual is for plesk 12 and i am using plesk 17.
what i have done is:
1) # yum install python-pip
2) # pip install virtualenv
3) i have installed Phusion Passenger from the web installer

i am stuck here... where to go from here

Noam
 
Hi Noam Harel,

to compile and install "mod_python" on a CentOS 7 operating system, you could use:
  1. Install the "Python - Developper - package" with for example:
    Code:
    yum -y install python-devel
  2. Go to the "LOCAL - SOURCE" folder
    Code:
    cd /usr/local/src/
  3. Download the Python - SOURCE - package with for example:
    Code:
    wget http://dist.modpython.org/dist/mod_python-3.5.0.tgz
  4. Uncompress the downloaded file with for example:
    Code:
    tar xfz mod_python-3.5.0.tgz
  5. Move the new folder
    Code:
    cd mod_python-3.5.0
  6. Before you can compile a package, you have to "CONFIGURE" it:
    Code:
    ./configure
  7. After a ( successfull ) configuration, you can now use:
    Code:
    make
  8. To finish your compilation, you would use:
    Code:
    make install
  9. Enable the module for your apache - webserver with for example:
    Code:
    echo 'LoadModule python_module modules/mod_python.so' > /etc/httpd/conf.modules.d/000-python.conf
  10. Restart your apache - webserver with for example:
    Code:
    systemctl restart httpd.service
 
Hi UFHH01

i did all your advices and when i got to configure i had this error:
[root@webnext mod_python-3.5.0]# ./configure
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/usr/local/src/mod_python-3.5.0':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.

Noam
 
Hi Noam Harel,

if the above suggested command doesn't work for you, you are as well able to use:

yum --setopt=group_package_types=mandatory,default,optional groupinstall "Development Tools"

or​

yum --setopt=group_package_types=mandatory,default,optional group install "Development Tools"

Another option to solve possible issue with "groupinstall" ( os - related ), is to use:

Code:
yum groups mark install "Development Tools"
yum groups mark convert "Development Tools"
yum groupinstall "Development Tools"
 
Hi!
I have a similar issue.
I have centos7 plesk and I like python.
I do not want to start compiling the mod python because I tried that once and it did nothing.
What I want is to enable python via cgi.
I put in my htaccess
Options +exec
AddHandler cgi-script .py
And its not working, getting 500 error.
The permissions of my helloworld.Py are execute on everything
Is it something to do with selinux?
The same thing works on a pleskless environment.
 
Back
Top