PHP Form Handler/Config Issue?

  • guitrspaz
  • Graduate
  • Graduate
  • guitrspaz
  • Posts: 106
  • Loc: Baltimore, MD

Post 3+ Months Ago

Hi all,
I'm having a problem with a PHP form handler that I've never seen before. When I submit the form, the browser tries to download the handler page (blank BTW) instead of rendering it in the browser.

If I hit the handler directly, it renders as expected. In the process of testing, I have ended up commenting out all PHP code except for
Code: [ Select ]
<?php ?>
and it still doesn't work.

I have Apache PHP running on a Windows Server dev machine (first time running PHP on Windows BTW), so I'm suspecting its a configuration issue, but I'm stumped.

Any ideas? Thanks!
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • PolishHurricane
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1585

Post 3+ Months Ago

I'm not sure if this is exactly what you mean, but I assume you're using a HTML form like this...
Code: [ Select ]
<form action="path_to_php_script.php">
<!-- stuff -->
  1. <form action="path_to_php_script.php">
  2. <!-- stuff -->
  3. </form>

What I assume is happening is your MIME type configuration on your apache server is invalid. What you need to do is find the section in your httpd.conf (apache configuration) file that says:
Code: [ Select ]
<IfModule mime_module>
#more stuff...
  AddType application/x-compress .Z
  AddType application/x-gzip .gz .tgz
  1. <IfModule mime_module>
  2. #more stuff...
  3.   AddType application/x-compress .Z
  4.   AddType application/x-gzip .gz .tgz

After the other types you need to put:
Code: [ Select ]
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
  1. AddType application/x-httpd-php .php
  2. AddType application/x-httpd-php-source .phps

This will make it so .php & .phps can be properly output to the browser with the proper MIME type.
  • guitrspaz
  • Graduate
  • Graduate
  • guitrspaz
  • Posts: 106
  • Loc: Baltimore, MD

Post 3+ Months Ago

Thanks. I have added the MIME types to httpd.conf. The page loads perfectly if I enter the URL in the only returns the blank file when the form is submitted.

The form code you posted is correct except I have method="post" enctype="multipart/form-data" in there because, once I get the form submitting properly, it needs to have a file upload.

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 122 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.