From owner-freebsd-questions@FreeBSD.ORG Wed Sep 19 19:56:45 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 6F19216A41B for ; Wed, 19 Sep 2007 19:56:45 +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 15D5713C467 for ; Wed, 19 Sep 2007 19:56:44 +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 l8JJuMQW027798; Wed, 19 Sep 2007 14:56:24 -0500 (CDT) (envelope-from kdk@daleco.biz) Message-ID: <46F17EE1.4050306@daleco.biz> Date: Wed, 19 Sep 2007 14:56:17 -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> <46F0377D.4030608@daleco.biz> <46F16992.2040002@fixer.com> In-Reply-To: <46F16992.2040002@fixer.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: FreeBSD Questions 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: Wed, 19 Sep 2007 19:56:45 -0000 orders@fixer.com wrote: Answer: Because it makes conversations flow in a nonsensical order. Question: Why is top-posting wrong? >> orders@fixer.com wrote: >>> 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). > Kevin Kinsey wrote: >> 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. orders@fixer.com wrote: >>> 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 >>> suitable 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. Kevin Kinsey wrote: >> 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.... orders@fixer.com wrote: >>> > *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. Kevin Kinsey wrote: >> 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. orders@fixer.com wrote: > I am using PHP/Mysql to manage my business database. I have a database > that contains my orders. I use my browser to print these orders. I > think it's the Apache SO version. /usr/local/bin/php and > /usr/local/libexec/apache/libphp5.so are there. I just reinstalled it > twice today with the exact same result. I reinstalled according to the > tip another guy sent me. I can use the php CLI, thats how I get 4 > pages of HTML code. But 'phpinfo()' still doesn't display in my > browser. Which files should i check permissions on to see if the groups > 'www' and 'nobody'? > I did check the '/var/log/httpd.error.log'. It says: > > > Wed Sep 19 10:42:56 2007] [notice] Apache/1.3.37 (Unix) PHP/5.1.6 > with Suhosin-patch configured -- resuming normal operations > > [Wed Sep 19 10:42:56 2007] [notice] Accept mutex: flock (Default: flock) > > [Wed Sep 19 10:43:56 2007] [error] [client 127.0.0.1] File does not > exist: /usr/ > > local/www/data/favicon.ico > > I did install the file 'favicon.ico' and that solved the problem, the > '/var/log/httpd.error.log' is now OK. > I already tried sending this problem to the PHP forms without any luck. Please carbon-copy the freebsd-questions list to make sure your mail isn't lost here. If Apache is running PHP as an SO, they you should have something like the following in /usr/local/etc/apache/httpd.conf: LoadModule php5_module libexec/apache/libphp5.so AddModule mod_php5.c AddType application/x-httpd-php .php If these aren't present, then Apache doesn't serve PHP documents properly. Kevin Kinsey -- Being ugly isn't illegal. Yet.