CWD is set to random domain in Python script

Created:

2016-11-16 13:12:19 UTC

Modified:

2017-04-24 11:43:12 UTC

0

Was this article helpful?


Have more questions?

Submit a request

CWD is set to random domain in Python script

Applicable to:

  • Plesk 11.5 for Linux

Symptoms

CWD is improperly set in Python script.

The following message appears in apache error log:

    Thu Apr 16 15:52:56 2015] [error] [client 1.1.1.1] mod_python (pid=17749, interpreter='example.com', phase='PythonHandler', handler='mod_python.cgihandler'): Application error
[Thu Apr 16 15:52:56 2015] [error] [client 1.1.1.1] ServerName: 'example.com'
[Thu Apr 16 15:52:56 2015] [error] [client 1.1.1.1] DocumentRoot: '/var/www/vhosts/example.com/httpdocs'
[Thu Apr 16 15:52:56 2015] [error] [client 1.1.1.1] URI: '/cgi-bin/execute.py'
[Thu Apr 16 15:52:56 2015] [error] [client 1.1.1.1] Location: None

Cause

Such behaviour is known as software issue #PPP-2745 and will be fixed in further updates.

Resolution

As workaround you need to modify the domain configuration file /etc/apache2/plesk.conf.d/vhosts/example.com.conf by replacing PythonHandler mod_python.cgihandler to PythonHandler mod_python.publisher :

</IfModule>
<IfModule mod_python.c>
<Files ~ (\\.py$)>
SetHandler python-program
PythonHandler mod_python.cgihandler
</Files>
</IfModule>
<IfModule mod_fcgid.c>

To make such configuration to be applied for newly created domains as well, it is better to perform changes via custom web server config templates at /opt/psa/admin/conf/templates/default/service/mod_python.php . In this case changes will not be overwritten on next domains configuration rebuild.

Please check the official guide for your reference.

Have more questions? Submit a request
Please sign in to leave a comment.