My site having 4-5 static pages only. index.html & index.php both are there. index.html is working fine. If I change to index.php, it's giving 500 Internal Server Error
. I don't know where is my mistake?
Note: If I use .htaccess file with php_flag display_errors 1
,
It's showing Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
If I use .htaccess file with empty
,
It's showing Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
And if I give ../contact-us.php
, it's showing correctly.
Thanks...
PHP Coding Timing Out If your PHP script makes external network connections, the connections may time out. If too many connections are attempted and time out, this will cause a "500 Internal Server Error." To prevent these time outs and errors, you'll want to make sure that PHP scripts be coded with some timeout rules.
Check the error_reporting , display_errors and display_startup_errors settings in your php. ini file. They should be set to E_ALL and "On" respectively (though you should not use display_errors on a production server, so disable this and use log_errors instead if/when you deploy it).
Check your logs ( /var/log/apache/error.log or /var/log/httpd/error.log, most likely); but I'd guess your PHP file has an error. 500 Internal Server Error is generic, the real cause is hidden in your server logs. I think this related to file permission, can you check other PHP file permission and compare with the one that you renamed...
Most 500 errors are server-side errors. Permission Error : Check permission of files and folders. In most of those cases, an incorrect permission on a PHP and CGI script is to blame. The permission should be set at 755.
These errors are all caused by permission issues. The first two lines indicate that the file's owner or group is set incorrectly. For example, if the owner of a PHP file is the nobody or root account instead of your user account, visitors receive an internal server error when they try to view the page.
Almost all of our servers run PHP as a CGI binary. One of the side effects of running PHP as a CGI binary is that internal server errors can occur if the permissions on files and directories are set incorrectly. Internal server errors can also occur if there are certain PHP directives defined in an .htaccess file.
500 Internal Server Error is shown if your php code has fatal errors but error displaying is switched off. You may try this to see the error itself instead of 500 error page:
In your php file:
ini_set('display_errors', 1);
In .htaccess file:
php_flag display_errors 1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With