HTTP Error 500 Internal server for php pages and solution

last updated in Categories Apache, lighttpd, Troubleshooting

You get “500 – Internal server error” error message when a user tries to access your Apache or Lighttpd based dynamic php application (such as forum or blog software).


Generally, to solve this problem you need to take help of log files located at following location:
=> /var/log/message
=> /var/log/httpd/error_logs (/var/log/lighttpd/error_log or /var/log/httpd/error_log)

So you may be wondering why your PHP script throws an Internal Server Error 500.

This error only occurs because of web server software. However after looking through logs you may not find many details. This problem may be caused by:

  • A malformed php cgi script
  • An invalid directive in an .htaccess or other config file
  • Limitation imposed by file system and server software (for example php log file size set to 10Mb)
  • Missing php.ini (or cannot read php.ini file)

In most case it is an invalid .htaccess directive. However recently I came across a web server w/o /etc/php.ini file. A long time ago I setup this server )Apache chrooted jail). So you need to maintain two files one outside jail and another inside jail:
=> /etc/php.ini
=> /chroot/etc/php.ini <-- this file was missing Many scripts open this file on fly to get correct configuration directives. If this file not found you get error 500. It took some time to figure out this problem. Finally strace helped me out to debug this problem. For me it was another day with another interesting problem 😉


Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

89 comment

  1. i got this same error on my motorola phone and i was curious if there was a way i could get rid of the problem. can you help me out?

  2. Hello there!
    Please help me solve http 500 internal server error.
    I use Dell Inspiron 6000, Windows Media Center Version 2005.
    The machine was configured to run default web services (on the same machine both server and client) with IIS 5.1. Ran some asp scripts; later php5 is also run and machine’s operation has been satisfactory.
    In the last week of April, an anti virus (corporate licensed version) Kaspersky is intalled. I didn’t use the machine immediately for my php5 / asp work.
    Subsequently the default web server never worked and every time it displayed the above error. Besides, ‘the windows audio tune’ one listens while logging on and off also did not come. all audio stopped working.
    As per advise of some experts, Kspersky Anti Virus has been de-installed/removed–no change; the error persisted.
    The Windows XP Prof is re-installed. The audio has come back but the default web server didn’t.
    Throughout this period the internet web browsing isn’t affected.
    Please let me have your valued help.

  3. I had a 500 result code from a GET of a simple PHPinfo .php file on my Windows Vista install of Apache 2.0 and PHP5. Everything in php.ini, httpd.conf was fine. The error log for httpd complained about:
    “PHP Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0:” trying to open php.ini or something.
    So it’s a permissions problem… but it’s Vista so what to do. Here is what worked after 4 hours of hacking. Open Services control panel, right click on Apache2 service, and change how the service starts/logs on to your Windows logon user. That made PHP module finally click with Apache2. Also, I changed the owner of c:/php to the same user (me) that I changed the httpd service to. Hope this helps save some time for some of you.

  4. hi guys if you could help me when i try to go to to see the poem i wrote the http 500 error comes out do you think this is a problem of mine or is the website,s problem thanx.

  5. Please help me in solving this probelm:
    Am using Dell server with 2003 OS, and Mozilla 1.8.20080.40413 version, I getting 500 Internal Server Error can’t pin point the problem as either refreshing the page or hitting back then clicking on the link again usually makes it appear.

  6. pls help me this problemof mind, my profile in tagged cant open.last nyt i change my bck ground then this is a result my profile is error… pls help me this problem,but i recieve the comment from my friends, i open there id but only my profile i can’t open, pls let me have your valued help. thanx

  7. i recieved this error just now after restarting my windows xp based, apache 2.5.6 wiht php 5.2.6 on index.php file…

    but with index.html is working fine

    and also, phpinfo.php is working 100% fine.

    any suggestion to resolve this issue or refferal guide to.

  8. This happens when there is a PHP error and your php.ini is set to hide error messages.

    There’s 2 ways to handle this:

    1. You have to analyze the Web Server log file. If you run Apache on Linux, it’s usually located at /etc/httpd/logs directory. On Windows, ~Apache_Dir/logs directory. Look at the last few lines of error.log file to find what PHP error occurred.

    2. If it’s a development box, you can set php.ini file as below so it prints error messages on a browser:
    error_reporting = E_ALL
    display_errors = On

    Alternatively, you can put these in .htaccess file:
    php_flag display_errors on
    php_value error_reporting 999999999

    Hope that helps.

  9. I’m getting HTTP 500 internal error. Please provide an answer. Thanks,
    Merry Christmas and Happy New Year!

  10. can the solution to this problem be put in better english so we can fix it ourselves?

    this problem only occures on my home pc when I try the web site and I always get the same message ! the rest of the net seems fine!

    its now getting to the point that I will reinstall the entire hard drive to fix it – a bit radical for such a silly problem

    please help someone

  11. hi,
    I am getting 500 Internal Server Error in shared web hosting when i try to insert records in database.
    I am using linux based in shared web hosting with apache 2.5.6 and php 5.2.6 .
    Please help me

  12. Sir , I aslo got http 500 error.i used yahoo web server.i search logfile for the cause.but i do not find any soloution. i do not find my script is caused for this error or server is the guily. i access mysql database 15times/second.i think this is the cause of the error. please guid me throw give me a mail.

    Thanks you in advanse.

  13. i`ve got the 500 error message just right now, pls. tell me what to do.. thnks and godbless..

  14. I’ve just got this……but what I noticed is it only happens if I’m retrieving over 497 rows from a database on one page……

    I’ve fixed it by adding a LIMIT 450 to the query……. So, I’m now thinking it could be a server/memory/mysql issue?

    php.ini’s memory_limit is set at 35M

  15. Sir,
    on click in the submit button do not go to the mail box.

    i using PHP for that purpose.

  16. I also have the 500 internal server error as well as a 404 not found error. do you know how to fix this problem? could you please tell me what to do. thanks

  17. I also have the 500 internal server error , Is it anything to do with zend engine, because it was working fine with wamp setup

  18. i also have the 500 internal error with some comment ” The page cannot displayed, there is a problem with the page trying to reach and it cannot be displayed “, could you please tell me what to do. thanks

  19. hello, i have a HTTP 500 INTERNAL SERVER ERROR.

  20. I have the same problem as marc. My yahoo mail will not open. I just get the http 500 error……since two days, when I let microsoft install updates.

  21. I cannot access my alternate email since I downloaded the new IE8 and Im9.0 keep getting HTTP 500 error! How can I fix ?



  23. One thing you might want to check is the permissions set on the public_html/ directory on a Linux server.

    I’ve had clients set them to 0777 and it causes this error, resetting to 0755 should fix this particular setting.


    You can’t fix it on your home computer!!

    The software on your home computer — e.g. “Windows Vista Home Premium” — is completely irellevant!!!


    It is unusual, but even large web service providers like Yahoo and Google screw things up sometimes and have 500 Server Errors.

    Contact them! e.g. If the problem is on Yahoo Mail, contact or similar.

    thank you and good night

  25. Hello everybody,
    HTTP 500 Internal Server Error may occurs when maximum execution time for perticular page gets over.
    Solution for this is to set the time limit.

  26. As if dial-up isn’t bad enough, all of a sudden I get the 500 error everywhere I have to log in. I can’t make a connection with anything I did lately. Missed a GREAT SHELL-SHOCKER AT NEWEGG…couldn’t log in.

  27. hey i have a Nokia N79 and i have a problem with the internet some sites give me the 500 internal server error please help the fastest way to solve…..


  29. Are you people all still retarded? A “500 Server Error” is not fixable by you. It is on the website itself. Contact the website operators.

    1. I am the website operator so what do i do to fix it. Im getting this error with godaddy when running a emailing php script on my hosting…

  30. Hi, everyone,

    I think many of you are confused with who should be dealing with these errors. These errors are coming from the server-side, not the client-side. This means that, unless you are the server administrator or something, you cannot correct this error. To have it fixed you should contact the server administrator and have that person examine the server’s error logs.

    I’m working on OS X, running Apache 2, and PHP 5.something. When I encountered this error using AJAX calls I found it was because of a syntax error in my PHP script. How did I find that out? Look at the server’s error log file! It’s very useful information.

    If you have no idea what I’m talking about, then the only thing you can do is complain to the server’s administrator until he/she fixes it. Sorry, bru.

    – Chase

  31. The server encountered an internal error or misconfiguration and was unable to complete your request.
    i get this error when i had run phpinfo(); for test
    please help me send your answer to me by email

  32. Hello,

    Im trying to access my companies intranet from home. But i get the “HTTP 500 Internal Server Error”. The wierd thing is that it works from my sisters computer. We both run windows vista. Can anybody tell me why i cannot access it from my computer?
    I have tried to turn of the windows firewall. did not help

    1. did you get your answer to this and how did you resolve this problem because i get this error on my computers at home, but i can access it on my mobile phone and when i ask my friends they said they can access it. Even my web servers support said they can access it, but i can’t on my end……….i know that 500 error is the web server so how in the world that i am the only one getting this error?

  33. Mine it said something like… highly trained monkeys… I just said WTF and it said to show them a freakin’ code, which apparently i wouldn’t understand. I just reset I.E. and it was fine again… WHAT THE HELL WAS THAT?! And i’m serious i’m telling the truth. If you don’t believe me and the error someday occurs to you, don’t be asking me for what the hell i know….

  34. can you help i was on this website and every time i try to turn the page it pops up 5oo internal server error

  35. I NEED HELP FAST AS I GET 500 ERRORS WHEN TRYING TO GET ONLINE BANKING. IF I DONT PAY MY RENT ON TIME IM FUCKED WITH NO HOME. HOW CAN I CONTACT THE WEBMISTER OF THIS SITE? 500 ERRORS is to much for my to handle and microsoft said to call HP but HP said to call this site, do you have a phone number? My bank called me a dick rash but my doctors says I dont have one, maybe thats why my wife left?

    How do I fix these 4004 errors?

  36. I can’t load my page because I get the 500 error after each release. But if I once set the cakePHP debug level higher then 0 (1, 2 or 3) it works properly even if I set it back. I just need to load the page one time in debug level higher then 0 and it works until I release my code again. It’s very strange to me and I don’t understand this problem. Can anyone help?

  37. I NEED HELP FAST AS I GET 500 ERRORS WHEN TRYING TO GET ONLINE BANKING. I can access my personal bank account with no problem. I keep getting this (HTTP 500 Internal Server Error) code when trying to acess my small business account. Can anyone explain this and help me overcome this problem?

  38. i just finished upgrading PHP 5.1 to 5.2 for sugarcrm. Unfortunately the url/website does not update while “click” on user agreement in firefox. My developer told this is due to ownership. please someone help me on this..

    1. For HTTP internal Server error 500 occurred means open the “htaccess” in notepad and save it as notepad. Then you will run surely it will work

  39. hi i keep getting

    This error (HTTP 500 Internal Server Error) means that the website you are visiting had a server problem which prevented the webpage from displaying.

    For more information about HTTP errors, see Help.

    i can only get on the internet via using run as adimistrator i have windows 7 and anysort of internet browser say this i was wandering what this is and how to fix it.

  40. i am getting internal server error when i run cgi file in linux.
    how to rectify this. please help me

  41. Every time i click on a certain page i want to go to, it always says the website cannot display the page, then its say http 500 error, ugh idk wat to do.?

  42. In my case it was display_errors = On.
    Unfortunately it was a real pain to identify the problem 🙂

  43. Also, please notice that you might get 500 Internal Server errors if your script is abnormally terminated by the server, due to it needing more than the allowed memory, or execution time.

    You should optimize your scripts not to consume so much memory.
    Until you do this, you could try raising the allowed memory by writing:
    ini_set(‘memory_limit’, ‘128M’);
    at the top of your php files

  44. I have got the 500 error for two days. I have undestood why but not been able to fix it yet.

  45. I have got the 500 error for two days in face book application. .i’m not able to overcome this problem . .and my mobile is Nokia c2-02 . . .please can u suggest anything

  46. Lol! JDS is right. Obviously “you people” are retarded because he/she has posted several comments telling you all WHY none of the other potential solutions from other commentors is not able to fix the problem. Wake up you guys!!! What part of “you can’t fix the problem on your own, you have to contact the web server admin.” do you not understand? Nevermind, you will most likely ignore my comment and continue to try and fix the error on your own anyway. Can’t say I’m all that surprised.

  47. I was running into the same problem in Ubuntu attempting to develop my own .php scripts.

    Oh sure, test.php with the phpinfo function worked just fine but when I tried running my own scripts…BOOM! Server error 500 Hell.

    After having read this page it didn’t exactly tell me what to do but it did point me to the log file which did (contrary to author’s opinion) tell me what exactly the problem was and how to fix it.

    sudo nano /etc/suphp/suphp.conf and make sure the following conditions are true:


    And that seems to take care of it.

  48. Hello alll i have a problem with .htaccess while adding authentication to the .htaccess file
    please anyone help me..

  49. Please help me on the same 500 internal error i cnt login to my Facebook account please send me the solution on my email,am using HTC hero

  50. I found my solution to error 500 was changing the path from “/var/www/ulogin” to “/var/www/ulogin/ulogin”

    It wants the path to the application

  51. If all else fails, do a factory reset. It solved two problems for me already when something kept popping up and wouldn’t go away.

  52. hi
    i use from mongodb and it configure on Wamp Server and for useing with php . i add mongo_php.dll in php5.4ext folder and add extension=php_mongo.dll
    in php.ini file but my server not work and occur this error Internal Server Error

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

    Please contact the server administrator at to inform them of the time this error occurred, and the actions you performed just before this error.

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

    please help me.

  53. Guys……..pls help me because my fb didn’t open yesterday bcoz of 500 internal server error pls guys help me

  54. The Problem may be due to 500 Server Error/404 Page Not Found.Please contact your system administrator. pl..solved

  55. I Got Same Response Code 500
    Because I write wrong code in PHP script in server side page ,
    after clearing the error ( Syntax error )

    Have a question? Post it on our forum!