# apache2+cgi: "Premature end of script headers" [SOLVED]

## supermihi

Hi,

I re-emerged some stuff around apache. Now I can't execute any cgi scripts in /var/www/localhost/cgi-bin. Apache sends "500 Internal Server Error", and in error.log appears:

```
[Sun Jul 30 20:15:20 2006] [error] [client 192.168.1.19] (2)No such file or directory: exec of '/var/www/localhost/cgi-bin/BackupPC_Admin' failed

[Sun Jul 30 20:15:20 2006] [error] [client 192.168.1.19] Premature end of script headers: BackupPC_Admin

```

This also happens with the default scripts printenv or test-cgi. Permissions should be ok:

```
-rw-r--r-- 1 apache apache  288 30. Jul 19:52 printenv

-rw-r--r-- 1 apache apache  779 30. Jul 19:52 test-cgi

```

Do you have any ideas?

----------

## Janne Pikkarainen

Actually the permissions are NOT ok. Those cgi scripts require +x rights. Try first

```
chmod 744 /var/www/localhost/cgi-bin/printenv
```

And then try to access that one.

----------

## supermihi

Thanks, that worked. Actually I had a problem with BackupPC_Admin, but I found that it was just that the first line was #/bin/perl instead of #/usr/bin/perl ....

----------

