Support » Installing WordPress » Running PHP as a CGI

  • Heya,
    I’m trying to install WordPress on a debian Woody install, with PHP 4.3.10-13 running as a CGI,and I have “mysql Ver 12.22 Distrib 4.0.24, for pc-linux-gnu (i386)”

    I followed these instructions first ( )
    to make sure that WordPress would work straight away, (ie. Edited the mentioned files before running wp-admin/install.php ) also edited the wp-config.php before doing anything else, basically followed the insructions (albeit from different sources)

    and my apache (apache two btw) error log is saying “Premature end of script headers: install.php”

    the usual source of this problem is putting a space between the “#!/usr/local/bin/php” and the <?php tag by mistake but in this case this mistake has not been made, i’m here all night so please if you have a question that may help you help me please ask 🙂

    ps. I really wish there was a preview post button here 🙂

Viewing 6 replies - 1 through 6 (of 6 total)
  • anychance anyone could have a look at this?

    I’m have the same problem:
    Here’s my apache tags:
    Apache/2.0.45 (Unix) PHP/5.0.5 FrontPage/ Server at Port 80
    MySQL: 4.1.12 installed from tar ball.
    index.php does the same.

    I’ve got a couple installs running with apache-as-cgi, no problems…. these are on webhosts not self-hosted.

    Are you sure you got the paths right in the config?

    I’m new to PHP, just an old, weak perl guy. Anyway, I threw all this stuff up into my cgi directory where I run perl scripts and it doesn’t run. I hacked a few PHP scripts in that directory and they did’t work either. The light came on! Nothing to do with wordpress, no PHP runs from that directory! It started to sink in that PHP is more like ASP than CGI, so I threw it over into my HTML directory, and the PHP scripts run! So, I’m on to the next step. Sorry to bother you all.

    About the original post to this thread: I would check to see if vim thougth the file to be “DOS” This happens with cgi perl scripts when samba is running and one is using notepad or something on a windows box to edit the file on the unix machine. Since unix only needs a <LF> and DOS needs both <CR><LF>, files edited on windows but ran under unix will have an invisible <CR> at the end. So, when the shell tries to find /usr/local/bin/php<CR>, it can’t.

    Two solutions: with vim, do a :set ff=unix and save the file. Or, create a symbolic link from /usr/local/bin/php to /usr/local/bin/php<CR>

    The last one’s my favorite for perl scripts I edit with notepad under windows and save to unix with samba. . .

    Hope that makes up for my stupid post.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Running PHP as a CGI’ is closed to new replies.