Title: Running PHP as a CGI
Last modified: August 18, 2016

---

# Running PHP as a CGI

 *  [thedara](https://wordpress.org/support/users/thedara/)
 * (@thedara)
 * [20 years, 8 months ago](https://wordpress.org/support/topic/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 ( [http://www.redbrick.dcu.ie/~wiki/mw/Installing_Wordpress_on_Redbrick](http://www.redbrick.dcu.ie/~wiki/mw/Installing_Wordpress_on_Redbrick))
   
   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)

 *  Thread Starter [thedara](https://wordpress.org/support/users/thedara/)
 * (@thedara)
 * [20 years, 8 months ago](https://wordpress.org/support/topic/running-php-as-a-cgi/#post-266383)
 * anychance anyone could have a look at this?
 *  [mcgoy](https://wordpress.org/support/users/mcgoy/)
 * (@mcgoy)
 * [20 years, 7 months ago](https://wordpress.org/support/topic/running-php-as-a-cgi/#post-266613)
 * I’m have the same problem:
    [http://mcgoy.plumbearcat.com/bin/wp-admin/install.php](http://mcgoy.plumbearcat.com/bin/wp-admin/install.php)
   Here’s my apache tags: Apache/2.0.45 (Unix) PHP/5.0.5 FrontPage/5.0.2.2634 Server
   at mcgoy.plumbearcat.com Port 80 MySQL: 4.1.12 installed from tar ball. index.
   php does the same.
 *  [vkaryl](https://wordpress.org/support/users/vkaryl/)
 * (@vkaryl)
 * [20 years, 7 months ago](https://wordpress.org/support/topic/running-php-as-a-cgi/#post-266614)
 * I’ve got a couple installs running with apache-as-cgi, no problems…. these are
   on webhosts not self-hosted.
 *  [estjohn](https://wordpress.org/support/users/estjohn/)
 * (@estjohn)
 * [20 years, 7 months ago](https://wordpress.org/support/topic/running-php-as-a-cgi/#post-266615)
 * Are you sure you got the paths right in the config?
 *  [mcgoy](https://wordpress.org/support/users/mcgoy/)
 * (@mcgoy)
 * [20 years, 7 months ago](https://wordpress.org/support/topic/running-php-as-a-cgi/#post-266618)
 * 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.
 *  [mcgoy](https://wordpress.org/support/users/mcgoy/)
 * (@mcgoy)
 * [20 years, 7 months ago](https://wordpress.org/support/topic/running-php-as-a-cgi/#post-266619)
 * 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.

## Tags

 * [CGI](https://wordpress.org/support/topic-tag/cgi/)
 * [installation](https://wordpress.org/support/topic-tag/installation/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Installing WordPress](https://wordpress.org/support/forum/installation/)
 * 6 replies
 * 4 participants
 * Last reply from: [mcgoy](https://wordpress.org/support/users/mcgoy/)
 * Last activity: [20 years, 7 months ago](https://wordpress.org/support/topic/running-php-as-a-cgi/#post-266619)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
