CWD is set to random domain in Python script


2016-11-16 13:12:19 UTC


2017-08-16 17:32:54 UTC


Was this article helpful?

Have more questions?

Submit a request

CWD is set to random domain in Python script

Applicable to:

  • Plesk 11.x for Linux


CWD is improperly set in Python script.

The following message appears in apache error log:

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


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


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

<IfModule mod_python.c>
<Files ~ (\\.py$)>
SetHandler python-program
PythonHandler mod_python.cgihandler
<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.