Help With Gallery

I followed the wombatnation description, but now i have an internal server error. I do not know what to do. I try phpo-cgi mode and regual php mode.

Please help me

Have a look in your error.log and see if you can find out what the actual errors were.

  • marsbar

Hi this is the anonymous guy.

The error log states this:
Premature end of script headers: /dh/cgi-system/php.cgi

The gallery was working fine last night. Do you htink dreamhost chanegd some of my settings?

i also added the line for php cgi and i tried erasing .htaccess

I am having the same issues, I do have a custom php, but it was working at first, now it refuses to work. How did you get yours to work?

Based on your description that everything was working, and then all of a sudden stopped working, my suggestion below may not solve your problem. But, it’s worth a try.

A common cause for the “premature end of script headers” error is that a text file was FTP’d in binary mode from a Windows machine to a Linux box Windows, Linux, and the Mac OS use different characters to signal the end of a line in a text file.

When the CGI processor (PHP, Perl, Python, etc.) hits the unexpected end of line character or characters, it exits the script prematurely. If the script was producing an HTTP response, it probably won’t have reached the point where it has created the appropriate HTTP headers.

As I mentioned before on other discussion threads, FTP clients aren’t always that smart about auto detecting when to transfer a file as ASCII or binary. Your FTP client may not be configured to automatically transfer PHP files as ASCII.

So, did you happen to edit one of the Gallery PHP files on a Windows machine and then FTP it back to your DreamHost server? If so, are you certain it was transferred as ASCII instead of binary?

If you know which file(s) you edited, use dos2unix from a shell prompt to fix it. Alternatively, FTP the file again and force your FTP client to use ASCII mode.


This gets stranger, I plan on moving the PHP binary to another location and trying it there.

No FTP involved, did a wget and untarred on the server.

Since I am running as an Apache module, I modified the .htaccess to use the CGI version of php instead. Knowing all the modules I need are not in DH’s PHP, I finished setup, and things were at least working, but not the features I wanted.

I then copied my custom PHP that I use for Horde to a cgi-bin directory inside the gallery directory, and modified .htaccess to point to the custom PHP, this caused the Internal Server Error, Premature end of script headers. Curious, this worked with the stock PHP CGI, so I assumed it was something compiled into the binary that gallery didn’t like.

Re-compiled PHP to cut out some un-needed stuff threw this into the gallery directory, and still a server error. Thinking something wierd was up, I again pointed to the Horde PHP binary, but this time, I left it in the Horde directory and pointed there. Things worked fine.

I thought I lost my mind, so I copied the stripped down PHP to horde, and it still worked fine. I copied both binaries back to the gallery directory, changed .htaccess again, and again, a server error.

It turns out, I had changed the cgi-bin directory to group write, and the server does not like that. I just found a link to the discussion on this, so for any others out there,


Thanks for listening, thanks for the help, and maybe I will point this out to DH support.