Premature end of script headers: hello.php
is returned by browser. (mozilla 1.7.2).

(8) Exec format error: exec of '/home/username/domain.com/hello.php' failed -- is the entry in /var/log/httpd/error_log

I am using Fedora Core 2. Since receiving this error, and some Internal Server Error 500's, I completely removed Apache 2.0.50, then reinstalled a new copy (via configure). I have also reinstalled PHP 4.3.8 and reconfigured --with-apxs=/path/to/apxs (and) --with-mysql.

The compile of PHP seemed to work fairly well, though I did get a couple of grumbles, which I believe I have attended to, 1) libtool --finish /path/to/php/libs, which I did, 2) chmod 755 on libphp4.so, and adding 3) /usr/local/lib/php to my include_path statement in php.ini.

So, my questions are 1) Why am I still not able to browse to my hello.php script, without getting this error, 2) why is life so finely complicated? 3) What are the top three books on implementing PHP?

Here is my simple script.

<html>
<head>
<title>PHP Test</title>
</head>
<body>
<?php echo '<p>Hello World</p>'; ?>
</body>
</html>

TIA for any help!

Andrew L.--
At any given moment, on a continuum between genius and dunce. Hope you're catching me on a good day! :bemused:

    Hi,

    just a guess...

    the problem might be that you configured apache to use PHP as module and CGI. Remove the CGI part from httpd.conf so that PHP gets loaded as module only (LoadModule ...).

    Thomas

      Bingo! Just like that, my problem is gone, thanks to that PHP guru known round these parts simply as "Tsinka". All I had to do was remove the <.php> entry I had added after the "AddHandler cgi-script" tag in my httpd.conf file, and voila--it worked straight away. I had labored over this for a VERY long time.

      Kudos to the PHPbuilder.com forum, and a BIG Thank YOU! once again to the real wizard, "Thomas"

        Okay, so now my hello.php script works fine in one directory, yet if I copy the script to a subdirectory I have called /cgi-bin, I get an error 500. When I copy it to another subdirectory, /rohs at that same level, the script executes fine.

        Hmmmm...

        Is the system parsing the directory and having a conflict since it expects only cgi-scripts to reside in the /cgi-bin directory? Probably.

        When I try to load my phpinfo.php in the same directory where hello.php works, I get nothing. It's like the system hangs but without errors. No hour glass yet no web page with info. I'll check for cyclical logic but at least I know it worked once and I have ... liftoff!!! http://www.phpbuilder.com/board/newreply.php?s=&action=newreply&threadid=10284987#

         :)

          Hi,

          don't put the php scripts into the cgi-bin directory. A common structure is e.g. (shortened):

          /some/dir
             cgi-bin
             htdocs
             includes
          

          cgi-bin: cgi scripts (e.g. perl)
          htdocs: images, styles, and scripts that are requested
          includes: include scripts (e.g. classes, config scripts) that shouldn't be in DOCUMENT_ROOT. The scripts can't be requested directly.

          Would you mind posting your httpd.conf (at least the cgi and php parts) ? Would make it easier to help you 🙂

          Thomas

            I've gotten through to the phpMyAdmin home page. Thank you for your help! I really appreciate it and I cannot tell you enough how much.

            I'll now go back to the basic installation documentation to make further progress. I need to do some tweaking on mysql users and privileges. That could take me a bit but hopefully soon, I'll be dynamically listing the results of mysql queries to the screen, complete with thumbnails and links to full photos. I'm attempting to put together a Hosta Database as my first major work.

            Ciao!

              Write a Reply...