开发者

Php is not being treated as a script, instead the php file is downloaded. Argg!

My site has a simple form to sign up to the newsletter by typing in your email and then pre开发者_如何学JAVAssing a button. However, when the button is pressed, the browser tries to download the actual php file instead. What am I doing wrong?


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.


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


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...


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜