From owner-freebsd-questions@FreeBSD.ORG Mon Aug 25 12:16:40 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5E9E316A4BF for ; Mon, 25 Aug 2003 12:16:40 -0700 (PDT) Received: from vogon.ccgis.de (vogon.ccgis.de [212.79.172.106]) by mx1.FreeBSD.org (Postfix) with ESMTP id DA58F43FBD for ; Mon, 25 Aug 2003 12:16:36 -0700 (PDT) (envelope-from thelen@ccgis.de) Received: from amavis by vogon.ccgis.de with virus-scanned (Exim 3.35 #1 (Debian)) id 19rMzw-00051I-00 for ; Mon, 25 Aug 2003 21:27:28 +0200 X-Scanned-By: AMaViS-ng at Geo-Consortium Bonn Received: from center.sz ([192.168.1.20] helo=center.shared) by vogon.ccgis.de with esmtp (Exim 3.35 #1 (Debian)) id 19rMzt-00051A-00 for ; Mon, 25 Aug 2003 21:27:25 +0200 Received: from localhost ([127.0.0.1] helo=center) by center.shared with smtp (Exim 3.35 #1 (Debian)) id 19rMl6-0008V1-00 for ; Mon, 25 Aug 2003 21:12:08 +0200 Received: from 192.168.2.109 (SquirrelMail authenticated user thelen) by vogon.ccgis.de with HTTP; Mon, 25 Aug 2003 21:12:08 +0200 (CEST) Message-ID: <4885.192.168.2.109.1061838728.squirrel@vogon.ccgis.de> Date: Mon, 25 Aug 2003 21:12:08 +0200 (CEST) From: "Benjamin Thelen (CCGIS)" To: freebsd-questions@freebsd.org User-Agent: SquirrelMail/1.4.1 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 Importance: Normal Subject: php4-cgi --> internal server errror X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Aug 2003 19:16:40 -0000 Hi, sorry, I've already posted this into the German user list, but as I am still completely stuck I hope to find some more hints/help here. Systems: FreeBSD 4.7 (mod_php4 - a little changed)& 4.8 (php4-cgi - the latest) Apache 1.3.27 and 28 We need to run php as cgi, because of the requirements of software we run (called umn-mapserver - if somebody knows). Half a year ago I basically followed the instructions I found on the umn-mapserver wiki-pages: I quote, that's shorter: (http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?PHPMapScriptCGI) PHP's default 'configure' behavior is to build a 'php' CGI executable. It's the --with-apxs and/or --with-apache PHP configure options that enable PHP to be built as an Apache DSO. ...to build PHP as a CGI ... don't provide the --with-apxs or --with-apache switch to the PHP configure. Then once you have a 'php' executable, copy it to your server's cgi-bin directory and add to your httpd.conf: AddType? application/x-httpd-php .php3 AddType? application/x-httpd-php .phtml AddType? application/x-httpd-php .php Action application/x-httpd-php /cgi-bin/php As I could not find an ordinary php-port (not sure now, it's month ago), I removed one "--with-apxs" entry within the Makefile from www/mod_php4 (!) and php ran as cgi! Half a year later, I updated the ports-tree and I was happy to see a www/php4-cgi port and immediately checked this out on a test system. This time, I did not edit the php4-cgi makefile of course, as I expected to have php4 as cgi compiled. I again copied the php-binary, as said above to cgi-bin and surprisingly saw only "500 - internal server error" and I found a "Premeture end of script headers: /usr/local/www/cgi-bin/php in httpd-error.log. One thing you have to know is, that our scripts are in /usr/local/www/data/"our-php-application". This worked on this 4.7/this edited mod_php4-system very well. I posted to the Germany user list, checked google. I found a few hints, but nothing really helped. e.g.: http://www.php.net/manual/en/security.cgi-bin.php http://httpd.apache.org/docs/howto/cgi.html My question basically is: How do I setup this php/cgi environment? One way, I was told and can be found on php.net is to add a "#!/usr/local/lib/php" on top of every php-Skript and all scripts need chmod a+x and need to be in /cgi-bin. This would work. But it is a little uncomfortable way and the main thing is that it would not work with our "php-application", which is a set of css, html, php, pictures, so pictures, css, etc would be parsed, too! There are other solutions, one with an AddHandler directive in httpd.conf, but I don't get that running. As it worked half a year ago and as there is a similar way in IIS, to map an extension (.php) to an application (c:\php\bin\php.exe), I suppose that there is a similar way, but I am just to blind to find the solution! My second question is: Why did it work with those instructions from umn-mapserver wiki-pages and why does the same thing not work now? One way to find out, what's wrong, was to cp /bin/cat to /usr/local/www/cgi-bin/php. But the error is the same. I would be very grateful for hints/help! Thanks in advance! Best Regards, Benjamin