You are here

Upgrading to Squeeze - and suddenly CGI doesn't work anymore

Before I upgraded from Lenny to Squeeze, all my CGI scripts were working properly. The CGI scripts has been executed by Apache and resulted in rendered webpage. After the upgrade to Squeeze all those CGI scripts stopped been executed but instead started to get displayed as a plain text.

Common to all those CGI scripts is that they have .phtml as suffix, but the bang path/shebang consists of "#!/usr/bin/python". As an example you can have a look at Buildd.Net and its scripts like this one. The section in Apaches config looks like this: 

        <Directory /home/builddnet/unstable/WWW/cgi/>
                Options -Indexes +ExecCGI +FollowSymLinks
                AddHandler cgi-script .cgi .sh .pl .py .phtml
                Order allow,deny
                Allow from all
        </Directory>

So, I would expect that the CGI script handler will get executed when loading a *.phtml file and that the shebang would be honoured. Funny enough: when I rename that script to *.cgi it works.

I haven't figured out yet, what causes this beahviour or what have changed during the upgrade - and how to revert to the old behaviour. So, dear lazyweb, can you give me some hints and pointers?

 

Kategorie: 
 

Comments

Some web server make .phtml PHP file. Do a `fgrep -r phtml /etc/apache` and see.

Well, yes, I tried that before as well, of course. There was just a "/etc/apache2/conf.d/php4.conf: AddType application/x-httpd-php .php .phtml .php3", but as I have no PHP4 anymore and I already removed that file yesterday, I'm quite sure that there has to be another reason for my problems.

It's likely php5.

Look into

/etc/apache2/mods-enabled/php5.conf

Due to the form of the regexp, you won't find it with grep.

Thanks! That did the trick. But I'm not sure that my "fix" of removing "tml" from "FilesMatch "\.ph(p3?|tml)$"" is the best way to fix the problem, but this doesn't help either:

<Directory /home/builddnet/unstable/WWW/cgi/>
Options -Indexes +ExecCGI +FollowSymLinks
<FilesMatch "\.phtml$">
SetHandler application/x-httpd-cgi
</FilesMatch>
AddHandler cgi-script .cgi .sh .pl .py .phtml
Order allow,deny
Allow from all
</Directory>

Adding some lines to each virtual host config is fine for me, as long as it works. But removing phtml from php5.conf gives me some headache that I will run in other problems over time. Changing all my phtml CGI files would be something I would like to avoid as well, although it might be the best solution.

Pages

Add new comment

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer