Ok, i am puzzled
"Jeff Trawick" <[email protected]> schrieb im Newsbeitrag
news:[email protected]...
Please try translating the CGI config directly to FastCGI as noted above,
instead of using the Plesk-generated config, and let us know what happens.
Replace this bit
<Files ~ (\.php)>
SetHandler fcgid-script
FCGIWrapper /usr/bin/php-cgi5 .php
Options +ExecCGI
Allow from all
</Files>
with
Alias /phppath/ /usr/bin/
<Location /phppath/>
SetHandler fcgid-script
Options +ExecCGI
</Location>
I could not get it to work in my httpd.include file as Apache was always
throwing an error (i.e. Alias not allowed here, Location not allowed here
etc....).
I ended up changing my /etc/apache2/conf.d/mod_fcgid.conf (excerpt) from:
---
##
## PHP via FastCGI
##
## uncomment the following line if you want to handle php via mod_fcgid
##
#<FilesMatch "\.php$">
# AddHandler fcgid-script .php
# FCGIWrapper /srv/www/cgi-bin/php5 .php
# Options +ExecCGI
#</FilesMatch>
##
</IfModule>
# End of <IfModule fcgid_module>
##
################################################################################
---
to
---
##
## PHP via FastCGI
##
## uncomment the following line if you want to handle php via mod_fcgid
##
#<FilesMatch "\.php$">
# AddHandler fcgid-script .php
# FCGIWrapper /srv/www/cgi-bin/php5 .php
# Options +ExecCGI
#</FilesMatch>
##
Alias /phppath/ "/usr/bin/"
<Location /phppath/>
SetHandler fcgid-script
Options +ExecCGI
</Location>
</IfModule>
# End of <IfModule fcgid_module>
##
################################################################################
so basically inserting your replacement code at the bottom inside the <IfModule
fcgid_module> container.
Now there are two things:
1) On virtual hosts which use 'FastCGI-Application' in Plesk and which
httpd.include looks like this:
<VirtualHost <IP>:80>
...
<Directory /srv/www/vhosts/domain.tld/httpdocs>
<IfModule mod_perl.c>
<Files ~ (\.pl$)>
SetHandler perl-script
PerlHandler ModPerl::Registry
Options ExecCGI
allow from all
PerlSendHeader On
</Files>
</IfModule>
<IfModule mod_python.c>
<Files ~ (\.py$)>
SetHandler python-program
PythonHandler mod_python.cgihandler
</Files>
</IfModule>
<IfModule mod_fcgid.c>
<Files ~ (\.fcgi)>
SetHandler fcgid-script
Options +FollowSymLinks +ExecCGI
</Files>
</IfModule>
<IfModule mod_fcgid.c>
<Files ~ (\.php)>
SetHandler fcgid-script
FCGIWrapper /usr/bin/php-cgi5 .php
Options +ExecCGI
allow from all
</Files>
</IfModule>
Options -Includes -ExecCGI
</Directory>
Include /srv/www/vhosts/domain.tld/conf/vhost.conf
</VirtualHost>
a) I sometimes get all files offered to download (not really able to replicate
this, it seems it is connected to the use of .htaccess and modify.php in the
same directory i sometimes get php files with image/jpeg header for download,
sometimes with x-httpd-php header...kind of bizarre...) and
b) The watermark image still fails for the same reason as stated before: PHP
tries to parse the image.
I have proof that this config uses mod_fcgid because phpinfo() gives only
_ENV["PATH"] under Environment plus i do get a _SERVER["Authorization"] and
other Auth variables when calling phpinfo() from a .htaccess secured directory
(AuthType Basic) which was not the case if it was mod_cgi.
2) Virtual hosts which use 'CGI-Application' in Plesk and which httpd.include
therefore looks like this:
<VirtualHost <IP>:80>
...
<Directory /srv/www/vhosts/domain.tld/httpdocs>
<IfModule mod_perl.c>
<Files ~ (\.pl$)>
SetHandler perl-script
PerlHandler ModPerl::Registry
Options ExecCGI
allow from all
PerlSendHeader On
</Files>
</IfModule>
<IfModule mod_python.c>
<Files ~ (\.py$)>
SetHandler python-program
PythonHandler mod_python.cgihandler
</Files>
</IfModule>
<IfModule mod_fcgid.c>
<Files ~ (\.fcgi)>
SetHandler fcgid-script
Options +FollowSymLinks +ExecCGI
</Files>
</IfModule>
<Files ~ (\.php)>
AddHandler php-script .php
Options +ExecCGI
allow from all
</Files>
Options -Includes -ExecCGI
</Directory>
Include /srv/www/vhosts/domain.tld/conf/vhost.conf
</VirtualHost
do get parsed using mod_fcgid as well now. Maybe this makes sense because in my
/etc/apache2/sysconfig.d/loadmodule.conf the mod_cgi.so comes before
mod_fcgid.so:
---
LoadModule cgi_module /usr/lib64/apache2-prefork/mod_cgi.so
.
.
.
LoadModule php5_module /usr/lib64/apache2/mod_php5.so
LoadModule fcgid_module /usr/lib64/apache2/mod_fcgid.so
---
and as the mod_fcgid.conf is read later(?) than mod_cgi.conf, the Alias setting
and the SetHandler fcgid-script take precedence which is why mod_fcgid is used
regardless of the Plesk setting, plus:
THE WATERMARK IMAGE SCRIPT DOES WORK !
To recap:
1. Using your replacement bits at the bottom of mod_fcgid.conf as stated above
2. Using the httpd.include (excerpt) with
<IfModule mod_fcgid.c>
<Files ~ (\.fcgi)>
SetHandler fcgid-script
Options +FollowSymLinks +ExecCGI
</Files>
</IfModule>
<Files ~ (\.php)>
AddHandler php-script .php
Options +ExecCGI
allow from all
</Files>
the watermark image gets displayed and phpinfo() states that mod_fcgid is used.
When in 2. you would choose 'FastCGI-Application' in Plesk which causes the
httpd.include (excerpt) to look like this:
<IfModule mod_fcgid.c>
<Files ~ (\.fcgi)>
SetHandler fcgid-script
Options +FollowSymLinks +ExecCGI
</Files>
</IfModule>
<IfModule mod_fcgid.c>
<Files ~ (\.php)>
SetHandler fcgid-script
FCGIWrapper /usr/bin/php-cgi5 .php
Options +ExecCGI
allow from all
</Files>
the watermark image fails with the same error like in the beginning:
Warning: Unexpected character in input: '' (ASCII=16) state=1 in
/srv/www/vhosts/domain.tld/httpdocs/image.jpg on line 234
Parse error: syntax error, unexpected '[' in
/srv/www/vhosts/domain.tld/httpdocs/image.jpg on line 234
I do not know what the bottom line concerning mod_fcgid is in terms of coding
but at least for me i can say that with the additions in mod_fcgid.conf and
using 'CGI-Application' in Plesk, i could use mod_fcgid in all my
domains/virtual hosts.
I am glad to help where i can trying to get mod_fcgid to work in Plesk without
this 'work-around'. I do not have a clue of C(++), though. But if this thread
helps to improve mod_fcgid then that already is a goal (to me).
Let me know what you think.