K
Kev
Guest
Hi all. I'm currently stumped by a problem of running different cgi wrapper files. My objective is to have different cgi wrapper files which run different versions of php so that we can easily test sites on different version of php by altering the vhost.conf. However what i have found is that the only cgi wrapper i can use for this is the default one provided as /var/www/cgi-bin/cgi_wrapper/cgi_wrapper. I am able to alter the file executed in cgi_wrapper to run my different php versions so those files do not seem an issue.
I'll summarise the full problem below but a very brief description (tl;dr version) is:
If i rename the cgi_wrapper file (and copy perms) and alter the Action for the handler the wrapper will not work, it's almost like it doesn't allow it if it has a different name, thus are only certain files allowed to be executed as cgi wrappers and if so how is that configured.
Setup is Ubuntu 10.04, apache 2.2.14
So these are the steps i take to reproduce the problem. First in the hosting settings for my domain I have specified no server side scripting. So nothing there can conflict.
Then in my vhost.conf for the domain i set up php using cgi by adding the following (as taken from whats added to vhost.conf when cgi is enabled):
php-script action is set in /etc/apache2/conf.d/php_cgi.conf and by default contains
with the domain reconfigured php now works. I can even alter cgi_wrapper to use a different php-cgi binary and this works.
now where things get confusing is if i now replicate cgi_wrapper with
both cgi_wrapper and cgi_wrapper2 have some user:group and perms
and alter /etc/apache2/conf.d/php_cgi.conf to be
and restart apache
if i call a php file i now get a 500 response and in the error log it says (the cgi uniformly unhelpful):
Any advice on this or as to as to whether this a plesk issue or apache one would be most appreciated because I really feel stuck on this and just editing the cgi_wrapper file to a different php bin seems like a hacky approach that wouldn't be good as we have multiple sites and some might use a particular php version permanently.
Thanks
I'll summarise the full problem below but a very brief description (tl;dr version) is:
If i rename the cgi_wrapper file (and copy perms) and alter the Action for the handler the wrapper will not work, it's almost like it doesn't allow it if it has a different name, thus are only certain files allowed to be executed as cgi wrappers and if so how is that configured.
Setup is Ubuntu 10.04, apache 2.2.14
So these are the steps i take to reproduce the problem. First in the hosting settings for my domain I have specified no server side scripting. So nothing there can conflict.
Then in my vhost.conf for the domain i set up php using cgi by adding the following (as taken from whats added to vhost.conf when cgi is enabled):
Code:
<Files ~ (\.php)>
SetHandler None
AddHandler php-script .php
Options +ExecCGI
allow from all
</Files>
php-script action is set in /etc/apache2/conf.d/php_cgi.conf and by default contains
Code:
scriptAlias /phppath/ "/var/www/cgi-bin/cgi_wrapper/"
Action php-script /phppath/cgi_wrapper
with the domain reconfigured php now works. I can even alter cgi_wrapper to use a different php-cgi binary and this works.
now where things get confusing is if i now replicate cgi_wrapper with
Code:
# cp /var/www/cgi-bin/cgi_wrapper/cgi_wrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper2
# chmod 755 /var/www/cgi-bin/cgi_wrapper/cgi_wrapper2
and alter /etc/apache2/conf.d/php_cgi.conf to be
Code:
scriptAlias /phppath/ "/var/www/cgi-bin/cgi_wrapper/"
Action php-script /phppath/cgi_wrapper2
if i call a php file i now get a 500 response and in the error log it says (the cgi uniformly unhelpful):
Code:
[Sat Mar 26 22:48:34 2011] [error] [client 81.105.99.186] Premature end of script headers: cgi_wrapper2
Any advice on this or as to as to whether this a plesk issue or apache one would be most appreciated because I really feel stuck on this and just editing the cgi_wrapper file to a different php bin seems like a hacky approach that wouldn't be good as we have multiple sites and some might use a particular php version permanently.
Thanks