Page 1 of 1

Apache error 500: exec format error

Posted: Sat Sep 12, 2009 9:59 am
by jsmith6
Hi!

I am running Apache 2.2.13 and PHP 5.2.10 on my home server. I am mostly running default settings (I have disabled directory listing for example).

I downloaded serendipity-1.4.1.tar.bz2 and decompressed it on the cgi-bin/ser directory. Next, I chmod 777 just for a test run on LAN, but I got a 500 error from Apache.

Here are the logs:

/var/log/httpd/error_log

Code: Select all

[Sat Sep 12 10:50:03 2009] [notice] Digest: generating secret for digest authentication ...
[Sat Sep 12 10:50:03 2009] [notice] Digest: done
[Sat Sep 12 10:50:04 2009] [notice] Apache/2.2.13 (Unix) DAV/2 configured -- resuming normal operations
[Sat Sep 12 10:50:06 2009] [error] [client 10.0.0.2] (8)Exec format error: exec of '/srv/httpd/cgi-bin/ser/index.php' failed, referer: http://10.0.0.3/
[Sat Sep 12 10:50:06 2009] [error] [client 10.0.0.2] Premature end of script headers: index.php, referer: http://10.0.0.3/
/var/log/httpd/access_log

Code: Select all

10.0.0.2 - - [12/Sep/2009:10:50:06 +0300] "GET /cgi-bin/ser/index.php HTTP/1.1" 500 535
access_log lines 1-1/1
What am I doing wrong?

Re: Apache error 500: exec format error

Posted: Sat Sep 12, 2009 1:20 pm
by garvinhicking
Hi!

This sounds like PHP is generally not working on your setup? Can you use mod_php, this is easier to setup than a CGI method?

Regards,
Garvin

Re: Apache error 500: exec format error

Posted: Sat Sep 12, 2009 3:50 pm
by jsmith6
I am... kind of new to this, so I don't know the difference between the "mod_php method" and the "cgi-bin method". I thought that all I had to do was put the Serendipity files in the /cgi-bin/ directory.

But here is some more. I found a line /etc/httpd/httpd.conf:

Code: Select all

# Uncomment the following line to enable PHP:
#
Include /etc/httpd/mod_php.conf
I uncommented it, and restarted Apache. Here is what's inside /etc/httpd/mod_php.conf (by default, I haven't touched it):

Code: Select all

#
# mod_php - PHP Hypertext Preprocessor module
#

# Load the PHP module:
LoadModule php5_module lib/httpd/modules/libphp5.so

# Tell Apache to feed all *.php files through PHP.  If you'd like to
# parse PHP embedded in files with different extensions, comment out
# this line and see the example below.
AddType application/x-httpd-php .php

# Tell Apache to feed all *.php, *.html, and *.htm files through
# the PHP module.  Add or subtract extensions here as desired.  Please
# note that running pages through PHP for no reason can be both slow
# and insecure, so be sure to know what you're doing.  It's a convenient
# shortcut, but probably isn't suitible for high-traffic sites if you
# write any of your pages in straight HTML.
#AddType application/x-httpd-php .php .html .htm

# This will display PHP files in colored syntax form.  Use with caution.
#AddType application/x-httpd-php-source .phps
However, the error remains:

access_log

Code: Select all

10.0.0.2 - - [12/Sep/2009:16:42:00 +0300] "GET /cgi-bin/ser/index.php HTTP/1.1" 500 535
error_log

Code: Select all

[Sat Sep 12 16:41:59 2009] [notice] Digest: generating secret for digest authentication ...
[Sat Sep 12 16:41:59 2009] [notice] Digest: done
[Sat Sep 12 16:42:00 2009] [error] [client 10.0.0.2] (8)Exec format error: exec of '/srv/httpd/cgi-bin/ser/index.php' failed
[Sat Sep 12 16:42:00 2009] [error] [client 10.0.0.2] Premature end of script headers: index.php
[Sat Sep 12 16:42:00 2009] [notice] Apache/2.2.13 (Unix) DAV/2 PHP/5.2.10 configured -- resuming normal operations
What can I try next?

Re: Apache error 500: exec format error

Posted: Mon Sep 14, 2009 9:57 am
by garvinhicking
Hi!

Serendipity is NOT a cgi-bin deployable installation; PHP usually lives in your document root, not the cgi-bin.

You might want to look into some general PHP introduction on how to use it:

http://us3.php.net/manual/en/install.php

The basic idea is that you use the LoadModule calls for Apache, and then you simply put your *.php files inside a VirtualHost DocumentRoot, and completely refrain from any "cgi-bin" subdirectory.

HTH,
Garvin