View Full Version : 500 Error Upon Contact Form Submission

07-17-2012, 04:39 AM
Hello everyone,

The issue below occurs when I submit to the following contact form (http://worldtreetech.com/index.php/contacts/9-ordering-billing-inquiry). I should also wish to point out that it is a Windows IIS 7.5 Server.

Error Summary
HTTP Error 500.0 - Internal Server Error
The page cannot be displayed because an internal server error has occurred.
Detailed Error Information
Module FastCgiModule
Notification ExecuteRequestHandler
Handler PHP via FastCGI
Error Code 0x00000000
Requested URL http://worldtreetech.com:80/index.php/contacts
Physical Path d:\home\wtt-php\htdocs\index.php\contacts
Logon Method Anonymous
Logon User Anonymous

Most likely causes:

IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred.
IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly.
IIS was not able to process configuration for the Web site or application.
The authenticated user does not have permission to use this DLL.
The request is mapped to a managed handler but the .NET Extensibility Feature is not installed.

Things you can try:

Ensure that the NTFS permissions for the web.config file are correct and allow access to the Web server's machine account.
Check the event logs to see if any additional information was logged.
Verify the permissions for the DLL.
Install the .NET Extensibility feature if the request is mapped to a managed handler.
Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click here.

I'm puzzled as to what my best course of action is to take. I would most appreciate if anyone could point me in the right direction.

Thank you so much in advance!



07-17-2012, 05:04 AM
There is most like an error in the PHP that handles the form. Could you post it?

07-17-2012, 05:29 AM
Thank you for the reply stevenmw,

The contact form is a component for Joomla. The very same component on the very same website worked when I had it running on another server. However, I never moved any databases, but actually manually added all the details from scratch as if it was a new website. Just thought I'd mention that to null out any thought of old database server info.

I believe this is the code you are looking for:

* @version $Id: contact.php 21991 2011-08-18 15:43:40Z infograf768 $
* @package Joomla.Site
* @subpackage Contact
* @copyright Copyright (C) 2005 - 2011 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt

defined('_JEXEC') or die;


class ContactControllerContact extends JControllerForm
public function getModel($name = '', $prefix = '', $config = array('ignore_request' => true))
return parent::getModel($name, $prefix, array('ignore_request' => false));

public function submit()
// Check for request forgeries.
JRequest::checkToken() or jexit(JText::_('JINVALID_TOKEN'));

// Initialise variables.
$app = JFactory::getApplication();
$model = $this->getModel('contact');
$params = JComponentHelper::getParams('com_contact');
$stub = JRequest::getString('id');
$id = (int)$stub;

// Get the data from POST
$data = JRequest::getVar('jform', array(), 'post', 'array');

$contact = $model->getItem($id);


// Check for a valid session cookie
if($params->get('validate_session', 0)) {
if(JFactory::getSession()->getState() != 'active'){
JError::raiseWarning(403, JText::_('COM_CONTACT_SESSION_INVALID'));

// Save the data in the session.
$app->setUserState('com_contact.contact.data', $data);

// Redirect back to the contact form.
$this->setRedirect(JRoute::_('index.php?option=com_contact&view=contact&id='.$stub, false));
return false;

// Contact plugins
$dispatcher = JDispatcher::getInstance();

// Validate the posted data.
$form = $model->getForm();
if (!$form) {
JError::raiseError(500, $model->getError());
return false;

$validate = $model->validate($form,$data);

if ($validate === false) {
// Get the validation messages.
$errors = $model->getErrors();
// Push up to three validation messages out to the user.
for ($i = 0, $n = count($errors); $i < $n && $i < 3; $i++) {
if (JError::isError($errors[$i])) {
$app->enqueueMessage($errors[$i]->getMessage(), 'warning');
} else {
$app->enqueueMessage($errors[$i], 'warning');

// Save the data in the session.
$app->setUserState('com_contact.contact.data', $data);

// Redirect back to the contact form.
$this->setRedirect(JRoute::_('index.php?option=com_contact&view=contact&id='.$stub, false));
return false;

// Validation succeeded, continue with custom handlers
$results = $dispatcher->trigger('onValidateContact', array(&$contact, &$data));

foreach ($results as $result) {
if (JError::isError($result)) {
return false;

// Passed Validation: Process the contact plugins to integrate with other applications
$results = $dispatcher->trigger('onSubmitContact', array(&$contact, &$data));

// Send the email
$sent = false;
if (!$params->get('custom_reply')) {
$sent = $this->_sendEmail($data, $contact);

// Set the success message if it was a success
if (!JError::isError($sent)) {

// Flush the data from the session
$app->setUserState('com_contact.contact.data', null);

// Redirect if it is set in the parameters, otherwise redirect back to where we came from
if ($contact->params->get('redirect')) {
$this->setRedirect($contact->params->get('redirect'), $msg);
} else {
$this->setRedirect(JRoute::_('index.php?option=com_contact&view=contact&id='.$stub, false), $msg);

return true;

private function _sendEmail($data, $contact)
$app = JFactory::getApplication();
$params = JComponentHelper::getParams('com_contact');
if ($contact->email_to == '' && $contact->user_id != 0) {
$contact_user = JUser::getInstance($contact->user_id);
$contact->email_to = $contact_user->get('email');
$mailfrom = $app->getCfg('mailfrom');
$fromname = $app->getCfg('fromname');
$sitename = $app->getCfg('sitename');
$copytext = JText::sprintf('COM_CONTACT_COPYTEXT_OF', $contact->name, $sitename);

$name = $data['contact_name'];
$email = $data['contact_email'];
$subject = $data['contact_subject'];
$body = $data['contact_message'];

// Prepare email body
$prefix = JText::sprintf('COM_CONTACT_ENQUIRY_TEXT', JURI::base());
$body = $prefix."\n".$name.' <'.$email.'>'."\r\n\r\n".stripslashes($body);

$mail = JFactory::getMailer();
$mail->addReplyTo(array($email, $name));
$mail->setSender(array($mailfrom, $fromname));
$mail->setSubject($sitename.': '.$subject);
$sent = $mail->Send();

//If we are supposed to copy the sender, do so.

// check whether email copy function activated
if ( array_key_exists('contact_email_copy',$data) ) {
$copytext = JText::sprintf('COM_CONTACT_COPYTEXT_OF', $contact->name, $sitename);
$copytext .= "\r\n\r\n".$body;
$copysubject = JText::sprintf('COM_CONTACT_COPYSUBJECT_OF', $subject);

$mail = JFactory::getMailer();
$mail->addReplyTo(array($email, $name));
$mail->setSender(array($mailfrom, $fromname));
$sent = $mail->Send();

return $sent;

07-18-2012, 04:27 AM
After checking for errors, I get the following.

Strict Standards: Declaration of ContactModelCategory::getItems() should be compatible with that of JModelList::getItems() in D:\home\wtt-php\htdocs\components\com_contact\models\category.php on line 19

07-19-2012, 05:03 AM
I ended up going with a new contact form. Guess it must have been witht he component itself since the new contact form is working now.