Hi,

I have the following code in test.php file

<form name=f1 method=get action="test.php">
<textarea name="question"></textarea>
<input type="submit" value="Submit">
</form>

If I enter "sample text" its working fine with http://www.example.com/test.php?question=sample+text

But if I enter "Create a view that does not contain the" its throwing the following error message with http://www.example.com/test.php?question=Create+a+view+that+does+not+contain+the


Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@example.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Recommended Answers

All 19 Replies

I think this error is not because of your code,
it is something else about,
try to google on it for fixing up:
Click here 500 Internal Server Error php

Thanks for you reply, actually I posted here after searching in google only.

It has to be an error in your htaccess.

Can you be more specific, I am new to PHP, let me know if you need any other information from my files.

check your web files folder for .htaccess named file, open it with note pad
and post here that code.. This also raises error.

There is no PHP in "test.php" so it is definitely not a PHP error. In fact, when you enter a question into the form and submit, it should just display a blank form again.

There are no .htaccess files created in the folder.

.htaccess file is usually hidden . . . you have to unhide it first. .the option comes when you click to open the root folder. .

What webserver are you useing?
:)

If you're using Linux, the URLs are all case sensitive. Make sure the case of the filename is what you're typing in as well.

Apache

Is it a wamp installation?

if yes and you are on Win OS. turn on hiddend files .
on xp. got to mycomputer -> menu list ->look for Tools -> folder Option and you will get a pop up. look for turn hidden file on.

Its a radio button.

Go back to your Wamp and look for .htaccess file. Just remove it.

2. If its not there...
Do you realize also that your url extension got encoding of foo+bar+spam... its eg.

question. Did you encoded that yourself or the file input did.?
If you did... Then you must make sure you decode that before you parse the url looking for the said link.

2. If your file name is spaced eg.. hello world.php ..., make sure you put them together like hello_world.php or anyway you like.
But they must be together.


If this trouble shooting does not help you. remove and install the server again.

;)

it may be because of the url that you are passing.
make sure your query string should be lowercase it will cause problem in Linux server and also check the condition inside your code is correct also if you redirecting to any where else.

Hi all,

I tried all the possibilities from internet, but none of them solved this error. I am giving more details here, hope I will get this error resolved soon.

File Name - TEST.PHP
File Content
<form name=f1 method=get action="test.php">
<textarea name="question"></textarea>
<input type="submit" value="Submit">
</form>

> I don't have any .htaccess file in the folder, also no .htaccess file created after getting the 500 Internal Server Error message.

If I access the above PHP via www.example.com/test.php and enter some text its working, but if I enter "Create a view that does not contain the" (or) some text which contains Create (or) database related words, its throwing the following 500 Internal Server error message.

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@example.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

> Server Error Log is showing the following message.
"[Tue Apr 26 17:54:12 2011] [error] [client 98.14.201.129] File does not exist: /home/example/public_html/500.shtml, referer: http://www.example.com/post.html"


Additional Details

Operating system linux
PHP version 5.2.17
Apache version 2.0.63


Thanks,

What do you expect to happen? In other words, what does "working" mean for this test? I don't think you have posted the whole of the "test.php" file, because the bit posted will do nothing.

Thanks for your reply, following is my full content. All I need is to display the textarea content after submitting the form.

File Name - TEST.PHP
File Content

<?php
       echo "Question = ".$_POST['question'];
     ?>

     <form name=f1 method=post action="test.php">
           <textarea name="question"></textarea> 
           <input type="submit" value="Submit">
     </form>

Thanks for your reply, following is my full content. All I need is to display the textarea content after submitting the form.

File Name - TEST.PHP
File Content

<?php
echo "Question = ".$_POST;
?>

<form name=f1 method=post action="test.php">
<textarea name="question"></textarea>
<input type="submit" value="Submit">
</form>

You have an internal error because your php code is wrong.

<?php
       echo "Question = ".$_POST['question'];
     ?>

should be

<?php
       echo "Question = "$_POST['question']; // $_GET['question'] depending on post/get
     ?>

pay attention to $_POST[] global var.
not .$_POST[].....
Take away the dot ok?

Thanks for your reply, I changed like below, but still the error is same.

<?php
echo $_POST['question'];
?>

<form name=f1 method=post action="test.php">
      <textarea name="question"></textarea> 
      <input type="submit" value="Submit">
</form>

Hello All,

This issue is fixed now !!! The error was coming because mod security was enabled in server and it was considering it sql injection attack. I have now disabled the rule of sql injection attack in mod security configuration and its working.

Thanks to every one for your valuable responses... !!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.