HTTP Error 500 Internal server for php pages and solution

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

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 89 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
89 comments… add one
  • kankan Nov 15, 2006 @ 4:29

    I get the error message just now

  • courtney Mar 5, 2007 @ 5:11

    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?

  • UKMoneyPot Mar 26, 2007 @ 16:18

    Was there something simple you had to add to the .htaccess file?

  • cpmresc May 16, 2007 @ 8:59

    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.

  • Joe Apache Dec 2, 2007 @ 9:12

    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.

  • gilbert Jan 13, 2008 @ 1:41

    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.

  • Shivakumar BM May 28, 2008 @ 4:21

    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.

  • akerajshynna Oct 8, 2008 @ 12:14

    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

  • female Dec 9, 2008 @ 19:24

    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.

  • CLee Dec 11, 2008 @ 20:49

    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.

  • magda Dec 14, 2008 @ 3:00

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

  • Jan 4, 2009 @ 20:07

    I M geting error 500 need to clear it

  • Jan 4, 2009 @ 20:13

    trouble with http error internal server for php pages

  • jon Feb 3, 2009 @ 21:55

    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

  • Kalpesh Feb 14, 2009 @ 12:04

    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

  • demonio Feb 21, 2009 @ 1:18

    i have 400 error in my internet plase help me to out this error….thanksss

  • Gourab Singha Feb 27, 2009 @ 17:46

    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.

  • aldrin d. boguilis Mar 6, 2009 @ 13:18

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

  • Peter Laws Mar 27, 2009 @ 11:56

    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

  • Amitava Das Apr 8, 2009 @ 18:17

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

    i using PHP for that purpose.

  • Sang Apr 9, 2009 @ 11:29

    Having the same issue with Jon — only got the http 500 internal error message on my home pc when trying the web site How do we solve this problem? Thanks!!!

  • alfred balagtas Apr 11, 2009 @ 6:34

    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

  • Nanjundappa Apr 14, 2009 @ 16:15

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

  • santo Apr 15, 2009 @ 2:23

    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

  • john Apr 24, 2009 @ 19:33

    please help me solve that problem , error500 internal server. thank you

  • Omio Jun 3, 2009 @ 20:56

    I’hv solved the problem. If you got 500 Internal Server Error Just set these settings with .htaccess 🙂

    php_value post_max_size 20971520
    php_flag magic_quotes_gpc off


  • MARC Jun 10, 2009 @ 21:37

    hello, i have a HTTP 500 INTERNAL SERVER ERROR.

  • Axel Jun 11, 2009 @ 1:13

    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.

  • Keith Brezinski Jun 11, 2009 @ 6:10

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

  • thiar Jul 2, 2009 @ 10:25



  • Martin Jul 30, 2009 @ 15:04

    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.

  • JDS Sep 2, 2009 @ 17:29


    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

    • Jennifer Oct 28, 2010 @ 19:34

      thank you for the information 😉

  • Dah've Sep 23, 2009 @ 12:29

    how to fix http server error, i’m connected to the internet but cannot open any web page

  • rahul Oct 24, 2009 @ 12:17

    hello vivek ,
    Thanks for the great helpful stuff on the site,
    i got the same internal server error ,
    i know there are lot reasons for the errors,
    i tried >> http://localhost/ >> it worked fine
    but when i tried >> http://mydomainname/ or http://myipaddress
    i got the internal server error
    can you suggest what could be the possible reason for this.

    • Pat Apr 7, 2011 @ 19:15

      Hi, I have the same issue as yours. Please did you ever get a solution to this?

    • Yawhnie Mar 17, 2012 @ 17:15

      I also get the same, but if u’ve got the solution pls hlp me out

  • Vinayak Nov 10, 2009 @ 7:09

    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.

    • Manasa Apr 10, 2012 @ 6:22

      how can i set time limit??

  • Beeber Nov 19, 2009 @ 23:12

    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.

  • elie Dec 28, 2009 @ 8:17

    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…..

  • arvind Feb 9, 2010 @ 23:49


  • JDS Feb 10, 2010 @ 1:14

    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.

    • Logan Dec 11, 2010 @ 5:57

      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…

  • Chase Isabelle Feb 23, 2010 @ 18:13

    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

  • volinh Feb 26, 2010 @ 4:57

    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

  • Martin Mar 9, 2010 @ 15:03


    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

    • Jasper Dec 11, 2011 @ 14:37

      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?

  • Martin Mar 9, 2010 @ 15:25

    also tried firefox, opera, ie…same story :/

  • segavagrant Jul 14, 2010 @ 9:00

    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….

  • Subash Roy Jul 26, 2010 @ 4:28

    http 500 internal server error

  • altashia Aug 8, 2010 @ 6:53

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

  • Bobbie Mullets Aug 25, 2010 @ 19:23

    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?

  • Mayur Sep 13, 2010 @ 6:43

    thanks for resolving my errors.

  • skee Oct 1, 2010 @ 9:44

    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?

  • kat-dady Dec 3, 2010 @ 14:28

    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?

  • soscode Dec 28, 2010 @ 4:45

    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..

    • Shahulhameed Jan 13, 2011 @ 13:04

      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

  • Mathieu Mar 2, 2011 @ 6:46

    i cannot open my mails due to erroe on page what to do

  • tom Mar 9, 2011 @ 2:42

    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.

  • vijayaganth Mar 25, 2011 @ 6:56

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

  • Maggie Jun 23, 2011 @ 22:47

    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.?

  • Adrian Jul 5, 2011 @ 10:58

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

  • satish Sep 18, 2011 @ 13:00

    i want to solve the 500 internal problem

  • Chris Oct 13, 2011 @ 6:25

    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

  • Darrell Nov 13, 2011 @ 7:58

    Thanks for that. Solved my issue and saved me a lot of head scratching.

  • Praveen Nov 16, 2011 @ 18:08

    Thanks a lot. Solved my issue quickly

  • SISWA EDI SUTRISN0 Jan 18, 2012 @ 4:36

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

  • biola Jan 18, 2012 @ 22:54

    i always see http 500 internal. server error html 1500 pls can u help out to solve the problem

  • JDS Jan 19, 2012 @ 14:00


  • delhiwonders Feb 6, 2012 @ 11:51

    Thanks for your help…

  • oztrout Mar 20, 2012 @ 12:38

    I dont see any help here …

  • Manasa Apr 10, 2012 @ 6:14

    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

  • ERIN May 8, 2012 @ 8:39

    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.

  • John Ortiz May 21, 2012 @ 15:00

    Excellent guide! Thanks for it!

  • vysakheg May 30, 2012 @ 7:26

    facebook login is error . 500 internal server error occured . Please help me fast.

  • wferguson Jul 17, 2012 @ 14:55

    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.

  • luckz Sep 6, 2012 @ 4:24

    docroot=/* may also be necessary.

  • Patrick Thomas Nov 23, 2012 @ 1:10

    I am making a php API and when I use a certain set of commands it gives an 500 internal server error. To view my error use with the method POST and the parameters:

    My API is

  • Naresh Dec 10, 2012 @ 4:30

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

  • subrata nath Mar 30, 2013 @ 3:03

    I want to solve http error 500 internal server for php pages and solution

  • salmi Apr 1, 2013 @ 14:02

    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

  • Al Jun 13, 2013 @ 15:29

    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

  • Karen Jun 3, 2014 @ 15:38

    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.

  • Mohammad rafiq Sep 26, 2014 @ 19:00

    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.

  • Ricky Doo Sep 20, 2015 @ 0:30


  • princess kate r jamorey Mar 20, 2016 @ 23:50

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

  • simanta Apr 20, 2016 @ 8:18

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

  • durgarao Mar 15, 2017 @ 10:13

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

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum