From owner-freebsd-questions@FreeBSD.ORG Tue Sep 18 20:55:00 2007 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6C96C16A418 for ; Tue, 18 Sep 2007 20:55:00 +0000 (UTC) (envelope-from kdk@daleco.biz) Received: from ezekiel.daleco.biz (southernuniform.com [66.76.92.18]) by mx1.freebsd.org (Postfix) with ESMTP id ED89813C4A5 for ; Tue, 18 Sep 2007 20:54:59 +0000 (UTC) (envelope-from kdk@daleco.biz) Received: from archangel.daleco.biz (dsl.daleco.biz [209.125.108.70]) by ezekiel.daleco.biz (8.13.8/8.13.1) with ESMTP id l8IKdUUo070702; Tue, 18 Sep 2007 15:39:31 -0500 (CDT) (envelope-from kdk@daleco.biz) Message-ID: <46F0377D.4030608@daleco.biz> Date: Tue, 18 Sep 2007 15:39:25 -0500 From: Kevin Kinsey User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.8.1.2) Gecko/20070418 SeaMonkey/1.1.1 MIME-Version: 1.0 To: "orders@fixer.com" References: <46F01640.9090000@fixer.com> In-Reply-To: <46F01640.9090000@fixer.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: questions@freebsd.org Subject: Re: php failing X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Sep 2007 20:55:00 -0000 orders@fixer.com wrote: > uname -a > localhost 6.2-RELEASE FreeBSD 6.2-RELEASE#0: Thu Aug 30 > 13:20:27 UTC 2007 root@:/usr/src/sys/i386/compile/VIL i386 > > I have been using apache, PHP and mysql for years with no problems. I > just suffered a computer crash and my backup failed, so I had to > reinstall. However, now I have a problem. I tried "pkg_add -r php5" > and the latest PHP5 from www.php.net(www.php.net used to work, but that > was before php5 existed). The first thing to note is that PHP can install three different executables: a CLI (command line interface) executable at /usr/local/bin/php, a CGI (common gateway interface) at /usr/local/bin/php-cgi, and an Apache SO (shared object) at /usr/local/libexec/apache/libphp5.so. So, first question, which of the above files exist? When you run `php -i` in a shell, you are accessing the CLI, most likely (running `which php` should tell you), and IIRC the package doesn't build the Apache SO, so the problem may be in your Apache configuration (is it configured to properly use the CGI executable?), or the complete lack of a CGI in the location shown above. > > If I access phpinfo() with my browser, it > > fails. When I try to run a PHP script, I get the error: > > >cgi error: > > The following CGI application misbehaved by not > > returning a complete set of HTTP headers. > > The headers it did not return are: > > > > This error message means PHP failed to output anything at all. To > > get to a sensible error message, change to the PHP executable > > directory and run PHP -i. If php has any problems running, then a suitgable > > error message will be displayed which will give a clue as to what needs to be > > done next. If you get a screen full of HTML codes, then PHP is > > working. > > > > Once PHP is working on the command line, try accessing the script once > > again. If it still fails then it could be one of the following: > > > > *The file permissions on your script, php.ini, or any extensions > > you are trying to load are such that the anonymous internet user > > ISUR_ cannot access them. This might indicate that you have the CGI *only*. Verify that the Apache daemon user (www? nobody?) has access to the files as mentioned above. And, likely, the same user should be able to run the CGI.... > > *The script file does not exit (or possible isn't where you think > > it is relative to your web root directory). If the script does not > > exit then the server will return a 404 error instead. > > I didn't get the 404 error, so I think my script exits. When I > > typed PHP -i, I received 4 pages of HTML code. This means PHP works. I tried > > phpinfo() from my browser and still nothing. I have been fighting this for 3 weeks and > > reinstalled many times. I tried this on FreeBSD-5.4, 6.1 and 6.2. All > > three operating systems produce the same result. > > I found out that apache runs in a jail and uses chroot. I added the > > directory it says and still nothing. > > This is where I get stuck. Thanks in advance for any help. The apache log (maybe /var/log/httpd.error.log?) should have some information, perhaps in addition to what you have seen. I don't know much about running Apache in a jail; you'll need to keep in contact with the list and hope that someone with a clue notices your problem. Since the question is really about PHP instead of FreeBSD, you might try some PHP forums/mail lists as well. Kevin Kinsey -- If Love Were Oil, I'd Be About A Quart Low -- Book title by Lewis Grizzard