# Solved: XAMPP "Internal server error"



## Gesp

Hi there

I`m using XAMPP to test a blog.

However, this message shows to me now every time I try to access the blogs pages and in doesn`t let me in XAMPP`s user mains page.

Whats happening? What can i do to solve this?

Thanks


----------



## MMJ

Most probably you have something bad in your .htaccess. Take a look at /apache/logs/error.log


----------



## Gesp

the error.log has a message that says:

.htaccess: RewriteEngine not allowed here

What happens here? I`ve gone to the .htaccess and it has a single sentence like this:


# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /xampp/mywebsite/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /xampp/mywebsite/index.php [L]
</IfModule>

# END WordPress

What should I do in order to solve the problem?


----------



## MMJ

What's the document root?


----------



## Gesp

what you mean the "document root"?

It`s a XAMPP php database, so it`s in the xampp main folder


----------



## MMJ

Doy you have an htdocs folder?


----------



## Gesp

yes


----------



## Gesp

yes I`ve got an htdocs folder


----------



## Gesp

Well, I`ve found a solution to my probem: Deleting the .htaccess file.

Is there a problem with this?


----------



## ehymel

Not a problem unless you need WordPress.

To eliminate the original error, you should modify the apache config file to allow the RewriteEngine to work from the .htaccess file with the AllowOverride directive.


----------



## Gesp

Well now I`ve got another problem, it gives me a 404 error when I try to go to another page besides the home page.

What is the problem?


----------



## ehymel

What step did you take to get the new error... eliminating the .htaccess or modifying the AllowOverride directive?


----------



## Gesp

I don`t know. I actually never tryed to move to another page before the error 500. To solve the error 500 I deleted the .htaccess file.

Could this be the cause of the problem?


----------



## ehymel

Yes and no.

Before you deleted the .htaccess, the server was complaining that you can't run the statements in the .htaccess file, so the whole thing was bombing.

Now without that file, the server is telling you that it can't find the files you are linking to. The missing .htaccess file is *not* the problem. You're links are simply pointed to files that don't exist, at least not in the place the server is looking.

The statements in the (now deleted) .htaccess file would have caught the error of the missing files and re-directed to the home page so your website wouldn't look broken (like it is now).

Hope this helps...


----------



## Gesp

The big probelm is that the solutions I had found at the time for the error 500 where about oweriting some statements, but in my .htaccess file they where just right, there was no problem with those statements but the problem persisted.

So, when I create a new post on the blog thats attached to my xampp server, doesn`t the blog system create automatically a page? so when I click on the post it is viewed in its entire structure?

I mean like: You have a blog and you create a post that has just a sentence of home page thats an introduction. And when you click on its title you wanted to go to the page where its entirely showed. Doesn`t that other page be created automatically?


----------



## ehymel

Can you post a link to your site?

Can you modify the AllowOverride directive in your site configuration to allow the .htaccess commands?


----------



## Gesp

No I`m still testing it through xampp and only then working everything fine I`ll host it online.

Yes I could modify with the notepad, but ever since I deleted the .htaccess file it disappeared. Don`t have it anymore.


----------



## ehymel

It's simple to recreate the .htaccess file... cut and paste from your post in this forum into a new file called .htaccess. Voila, you've got it back.


----------



## MMJ

Gesp said:


> yes I`ve got an htdocs folder


Well your rewrite path is screwed up. /xampp/mywebsite/ is above the document root.


----------



## Gesp

ehymel said:


> cut and paste from your post in this forum into a new file called .htaccess. Voila, you've got it back.


Paste what?

I deleted it, I have nothing to show you. Must I download one that I find on the web?

The Path is not screwed as it is just like it came from the downloaded XAMPP that I got on the official site.


----------



## ehymel

Gesp said:


> I`ve gone to the .htaccess and it has a single sentence like this:
> 
> 
> # BEGIN WordPress
> <IfModule mod_rewrite.c>
> RewriteEngine On
> RewriteBase /xampp/mywebsite/
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteCond %{REQUEST_FILENAME} !-d
> RewriteRule . /xampp/mywebsite/index.php [L]
> </IfModule>
> 
> # END WordPress


Paste the text in red (taken from your own posting) into a new file, which you will call .htaccess, in your web folder.


----------



## Gesp

Oh yeah I forgot

Ok I`ts done now and I saved it as a .inc file, I guess it was that terminal it was using, right?


----------



## Gesp

It does nothing, the problem persists


----------



## MMJ

create a php file in your document root.

enter this:



PHP:


<?php
echo getcwd();
?>

call it something like test.php

tell me the results...


----------



## ehymel

Gesp said:


> I saved it as a .inc file,


NO! Save it as a file called .htaccess. That is the ONLY way it will be picked up correctly. You will ALSO have to modify the config file to allow for this. See my posts above.


----------



## Gesp

I`m not shure what your telling me to do. How can I create a file without a type terminal. What should it be? .txt .php .inc ?


----------



## Gesp

ok I`ve done it, never mind what I said.

Now how can I allow the RewriteEngine through the site?


----------



## ehymel

For now, just trust me. The following line contains the ENTIRE filename. 

.htaccess

The first character is a dot (or period). You have to have it. There are no other characters. There is no "type terminal", which I assume you mean an extension that tells Windows what program to use to open the file. There is no need for an extension on this file.


----------



## MMJ

Stop having downs and go with the easier to debug and more likely problem. XAMPP is setup to allow rewrites through .htaccess, so while this is a possibility you might wanna eliminate the path problem first. -_-'


----------



## Gesp

Yes, I`ve created now one without an extension.


----------



## MMJ

ehymel said:


> For now, just trust me. The following line contains the ENTIRE filename.
> 
> .htaccess
> 
> The first character is a dot (or period). You have to have it. There are no other characters. There is no "type terminal", which I assume you mean an extension that tells Windows what program to use to open the file. There is no need for an extension on this file.


If you had half a brain, you would realize you can't create a file like that through the Windows UI, you have to do it through CMD.


----------



## ehymel

The directive you need in your config file is this one:



Code:


AllowOverride All

Where you put it will depend on how you have things set up. If you search your httpd.conf file (the master config file for all of apache), you will likely see a line that says AllowOverride None. The easiest thing to do for starters is simply change that to AllowOverride All.


----------



## Gesp

I`ve created one through notepad. And It assumes it as a .htaccess file in its integrity.

MMJ Well, I`d say to you that your help is really appreciated, but as you start offending whose trying to help too and making me read that your a distinguished member, makes me advice you to calm down, where just discussing a problem here.
A little chat will certainly solve this complication, just chill


----------



## MMJ

> that your a distinguished member


Distinguished Member is just a post count....

Also, it's you're in this case, not your.


----------



## Gesp

Yes, ok.

But hey I changed the httpd.conf AllowOverride expressions that where None to All and I`m encountering the same error 404 as I try to go to another page... so... Lets try another solution.

MMJ, what do you call my root folder? xampp s parent folder or the one where I have my site files?


----------



## MMJ

Gesp said:


> Yes, ok.
> 
> But hey I changed the httpd.conf AllowOverride expressions that where None to All and I`m encountering the same error 404 as I try to go to another page... so... Lets try another solution.
> 
> MMJ, what do you call my root folder? xampp s parent folder or the one where I have my site files?





MMJ said:


> create a php file in your document root.
> 
> enter this:
> 
> 
> 
> PHP:
> 
> 
> <?php
> echo getcwd();
> ?>
> 
> the one where you have your sites files... http://www.google.com/search?q=document+root
> call it something like test.php
> 
> tell me the results...


the one where you have your site's files http://www.google.com/search?q=document+root


----------



## Gesp

I`ve tryed puting the file on various places I could call root and it did nothing


----------



## MMJ

Put it in the same folder as index.php, and call it like you would call index.php.

example: http://localhost/test.php


----------



## Gesp

It goes to the error 404 page again


----------



## MMJ

Go to the directory in which you placed test.php. Copy the address bar (example: C:\xampp\htdocs\site) and paste it here.


----------



## Gesp

I tried these:

M:\xampplite\htdocs
M:\xampplite\htdocs\xampp
M:\xampplite\htdocs\mywebsite


----------



## MMJ

put test.php in M:\xampplite\htdocs (so it is M:\xampplite\htdocs\test.php)

go to http://localhost/test.php

take a screenshot of the 404 error. alt+printscreen, paste in windows paint, save image.

attach it to your next post


----------



## Gesp

Oh, since I added now the .php at the end (didn`t know I had to) now it doesn`t appear a error 404 it simply apears the address "M:\xampplite\htdocs" written on the page.


----------



## MMJ

Okay, that's good.

Which directory is wordpress installed under?


----------



## Gesp

word press is in M:\xampplite\htdocs\xampp\mywebsite

The files are in mywebsite


----------



## ehymel

MMJ said:


> If you had half a brain, you would realize you can't create a file like that through the Windows UI, you have to do it through CMD.


MMJ, not sure why you're being such an ***, but the other half of my brain tells me you *can* create a file like that through Windows GUI (just turn off the hiding of file extensions) or through lots of other methods, just like Gesp ended up doing.

Gesp, looks like you had 2 problems all along. I'm sure MMJ will be walking you through the path problem that you are having. Best of luck!


----------



## MMJ

Do you still have the .htaccess file? If so, where is it located?



ehymel said:


> MMJ, not sure why you're being such an ***, but the other half of my brain tells me you *can* create a file like that through Windows GUI (just turn off the hiding of file extensions) or through lots of other methods, just like Gesp ended up doing.
> 
> Gesp, looks like you had 2 problems all along. I'm sure MMJ will be walking you through the path problem that you are having. Best of luck!


http://www.htaccesstools.com/htaccess-faq/#makeHtaccessWin



> Windows will not let you rename a file to ".htaccess". You will get an error "You must type a filename"


----------



## Gesp

The .htaccess is located in:

M:\xampplite\htdocs\xampp


----------



## MMJ

Hit Windows+R, type *DIR M:\xampplite\htdocs\xampp > m:\dir.txt*

Open *dir.txt* under M:\ and copy, paste contents here.


----------



## Gesp

As I type that on the run prompt, is says that cannot find the "DIR" directory and does nothing.
Tell me what to do manually, what should I write on the the dir.txt? Or what do you want to know?


----------



## MMJ

Well that makes no sense....

Open CMD, type


Code:


M:
cd xampplite
cd htdocs
cd xampp
dir > /dir.txt

Open dir.txt under M:\ and copy, paste contents here.


----------



## Gesp

Directory of M:\xampplite\htdocs\xampp

29-03-2010 19:37 .
29-03-2010 19:37 ..
29-03-2010 18:13 254 .htaccess.htaccess
20-12-2009 01:00 42.512 AnkeCalligraph.TTF
29-03-2010 18:36 mywebsite
20-12-2009 01:00 7.298 biorhythm.php
20-12-2009 01:00 7.318 cds.php
20-12-2009 01:00 89 cgi.cgi
20-12-2009 01:00 720 components.php
20-12-2009 01:00 2.472 head.php
20-12-2009 01:00 3.407 iart.php
22-03-2010 21:14 img
20-12-2009 01:00 1.452 index.php
20-12-2009 01:00 4 ip.html
22-03-2010 21:14 lang
20-12-2009 01:00 343 lang.php
20-12-2009 01:00 997 langsettings.php
20-12-2009 01:00 2.512 mailform.php
20-12-2009 01:00 2.277 mailsend.php
20-12-2009 01:00 704 manuals.php
20-12-2009 01:00 1.619 ming.php
20-12-2009 01:00 2.810 mingswf.php
20-12-2009 01:00 124 mysql.php
20-12-2009 01:00 4.406 navi.php
20-12-2009 01:00 437 navibasics.inc
20-12-2009 01:00 115 naviservers.inc
20-12-2009 01:00 244 navitools.inc
20-12-2009 01:00 5.694 phonebook.php
20-12-2009 01:00 43 php.php
20-12-2009 01:00 27 phpinfo.php
20-12-2009 01:00 431 showcode.php
20-12-2009 01:00 856 softwarelist.inc
20-12-2009 01:00 1.281 splash.php
22-03-2010 21:14 sqlite
20-12-2009 01:00 4 ssi.inc
20-12-2009 01:00 86 ssi.shtml
20-12-2009 01:00 1.167 start.php
20-12-2009 01:00 6.394 status.php
20-12-2009 01:00 4.383 xampp.css
20-12-2009 01:00 639 xampp.js


----------



## MMJ

Good.

Open CMD, type


Code:


M:
cd xampplite
cd htdocs
cd xampp
ren .htaccess.htaccess .htaccess

Move .htaccess to the mywebsite folder.

Check if you still get a 500 error


----------



## Gesp

its done


----------



## MMJ

?..


----------



## Gesp

yes, I`ve done that with the cmd, but it did nothing, just removed the name of the htaccess file and I insterted it in the mywebsite folder.

When I try to open the site it gives me an error 500 again, but as i name the file .htaccess again it comes to the same part as before, the error 404 persists and I`m able to see only the home page.


----------



## Gesp

After making some tests I`ve discovered that the problem is related to my .htaccess file definitely.

If I change my Permalink configurations the wordpress manager automatically generates anothes htaccess file and if so my site gives me the old error 500.

Then replacing the automatically generated file by the old one, even though they have the same thing written in them, the error 404 situation gets back on.

So, after viewing almost 40 posts that refer to the 404 error in some sites, I assume that no one knows a true solution to this.

And my conclusion is that WordPress filled with stupid errors. But since there's no best for managing a blog, I have to adapt my self to it. And so I analized my httpd.conf and my .htaccess files and saw that the problem must be related to the permalinks.

I am so pissed with this.
How come a stupid thing can be so complicated, I mean, blogger has it all fine, why does wordpress complicate so much.


----------



## ehymel

Gesp,
I agree this can all be frustrating. Once you get it all working it's really a feeling of accomplishment! There are often good reasons, usually for security, that things are set up the way they are. I don't use blogger, so I can't speak to that one.

Questions:
1. Do you have a virtual host set up for the site you are serving? Likely not if you don't know what I'm talking about, or if you are accessing your site through localhost.
2. In your httpd.conf file (or in any vhost files), do you have any sections called <Directory> that apply to the wordpress site you are trying to get running?

Suggestion: every time you see the 500 error, check your apache log file to see what the error says. That's usually a great clue about what is going on. When you reported this earlier, you said the log said "RewriteEngine not allowed". That usually means the AllowOverride directive needs to be modified. If you have done this, perhaps the 500 error you see now has changed. Worth checking into.

Having said all of that, it may be that the .htaccess file has nothing to do with your 404 error. Make sure to check in the General Settings section of wordpress to set the Blog Address (URL) to the correct location. In general this should match the WordPress address listed on the line above.


----------



## Gesp

I`ve used blogger before, but it`s a big default structure, nothing I`d recomend to someone that wants something more professional and more individual.

Well I`ve been doing some tests and found the source of the problem is the permalinks section. I now have this all working as I wanted, but I solved it by changing the permalinks to the Default style.

However I wanted some help on getting this to work OK and have a custom permalink.
Every time I change this to a custom one It just returns to the error 500 routine.


----------



## ehymel

Can you post the .htaccess generated by the default permalink style, and also post both the .htaccess for the custom style and the corresponding error message in your log file? Which custom style are you choosing?


----------



## Gesp

Sorry for only replying now. 

Didn`t have much time to reply lattely, but I found the source of the problem and there is no simple way to jump the issue on wordpress (emulated on an external server).

The problem comes from the permalinks definitions. Basically changing these options I`d recomend to do it only when already working in the hosting server system.

Well, I`m considering this solved guys.

10000x thanks for the help. This problem turned this thread the one with most posts on the Web and Development archive. (just a detail)


----------

