tags:

views:

67

answers:

5

My site has a simple form to sign up to the newsletter by typing in your email and then pressing a button. However, when the button is pressed, the browser tries to download the actual php file instead. What am I doing wrong?

+3  A: 

The server is not configured to treat that file as a PHP program. Maybe the server doesn't support PHP at all. You need to check if your hosting package includes PHP support.

David Dorward
A: 

Your server doesn't seem to recognize and forward php files to php engine. The following links might get you started:

http://blogs.iis.net/donraman/archive/2009/11/15/troubleshooting-php-installation-on-windows.aspx

http://www.janetvalade.com/installation/trouble.html

Sarfraz
A: 

You need to set up the correct mime type in httpd.conf and make sure that PHP engine is enabled.

Nick Brooks
A: 

Assuming the sign up form used to work, it sounds like either there may have been some corruption of the PHP install or your web host has changed/moved your data to another server that doesn't have PHP installed...

Alex
A: 

Are you using Apache, IIS, or something else?

If you are using Apache 2, then you need to tell Apache to use PHP for .php files, following this page.

Essentially, what's happening is that the web server receives the request for the page supercoolstuff.php, and looks in its configuration to see whether it should treat .php files differently. With the correct configuration (and PHP installed!) it will see that it should use PHP to parse the file, parse it and send the output back. If, however, PHP isn't installed, or is not set up, or lacks a module - mod_php in Apache (install instructions) - then you will just get a statically served page, as you are seeing here.

If it's a Unix/Linux machine, try running php '<?php phpinfo() ?>' at the command prompt. If you get stuff, you have PHP installed, so you probably need to install and/or setup mod_php.

Phil H