I have an Ubuntu virtual server where I host my php website with the newest version of Plesk 12 and PHP 5.5. Sometimes (I believe when I open pages quickly one after another), I get an Internal Server error message..
When I refresh the page, the site is normal again immediatly, but sometimes the error message dissappears after about one minute later.
this is what I get on the page:
Internal Server Error 500.
The server encountered an internal error or misconfiguration and was
unable to complete your request.
Error log:
[fcgid:warn] [pid 26583] (104)Connection reset by peer: [client (ip
address)] mod_fcgid: error reading data from FastCGI server, referer:
(url here)
[core:error] [pid 26583] [client (ip address)] End of script output
before headers: index.php, referer: (same url here)
Given your error log it looks like the index page wanted to write an HTTP header (with either header() or set_cookie or similar) AFTER it printed regular output, in your case probably a warning message due to an interrupted connection.
What I would try to do is disable all error output in the page with the php.ini, but still log the errors.
PHP can only output HTTP header fields before any other regular output, warning and error messages on the page included. So if you direct all errors and warnings only to the log files, and NOT print them on the page, there will be no output before the HTTP header and it should work fine.
If any PHP script causes an error, try following this procedure:
Switch from FastCGI to CGI
Trigger an error with another request
Inspect error_log for actual errors, fix them accordingly
Switch back to FastCGI
If configuration files like apache.conf have an error in them it will not appear in the error log with FastCGI on.
Related
I am receiving 500 errors on my Magento webshop.
First the problem occurred only in checkout/onepage and only when logged in (not as guest).
Now every page return a 500 error.
What I have tried:
I have run a magento-cleanup script to reset all file permissions.
I have checked the magento logs, but no errors present themselves.
Clearing cache.
Removing root htaccess.
Apache error
Apache error log gives the following message for all 500's:
[:error] [pid 13758:tid 3006368270080] (104)Connection reset by peer: [client 2a02:1810:1014:a400:2526:ccb1:97d4:72e6:28829] FastCGI: failed to read from backend server
The website itself gives no errors (php) although I have set all the debug options in index.php.
I have contacted my hoster to check the FastCGI message. But I am thinking the problem remains with Magento.
The problem was solved with cooperation from the hoster.
There was a problem with the APC Cache system.
The solution here was to add this to php.ini:
zend.enable_gc = 0
I have two simple test files, one a basic HTML document that displays a simple message and the other a PHP document that does the same.
If I access the HTML document using a URL like this it displays properly:
sample.com/test.html
If I access the PHP file in a similar manner it also displays properly:
sample.com/test.php
Accessing the HTML file from a subdirectory also works just fine:
sample.com/somedirectory/test.html
However, accessing the PHP page in a similar manner does not work:
sample.com/somedirectory/test.php
It produces 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, webmaster#samplehs.pltwcs.org 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.`
EDIT
Here is the HTML code:
<html>
<body>
hello world
</body>
</html>
And the PHP code:
<?php
phpinfo();
?>
Here's what the server's error log has to say:
[Wed Dec 18 12:58:08 2013] [error] [client 71.222.168.54] File does not exist: /home/username/public_html/500.shtml
[Wed Dec 18 12:58:08 2013] [error] [client 71.222.168.54] SoftException in Application.cpp:256: File "/home/username/public_html/somedirectory/test.php" is writeable by group
You have to set the permissions of your PHP files to 644 and folders to 755 because your server has suEXEC enabled.
From the terminal you should run chmod 644 test.php or use any FTP client to set your permissions
Source
Source #2
Based on the error File "/home/username/public_html/somedirectory/test.php" is writeable by group your server is using something like suphp, and you need to remove write permissions from group: chmod go-w /home/username/public_html/somedirectory/test.php from command line.
I'm having an issue with a CURL reader I built (see: Premature end of script headers: php-cgi -- While running a CURL script)
The guy said to check if my problem server will speak to the feed, so I tested the below code locally and it works, tested in on the server and got an internal server error. I am lost here, how should I go about debug this as the host company are not being very helpful at all.
code:
$url = 'http://www.energydigger.com/feeds/headlines.xml';
list($status) = get_headers($url);
if (strpos($status, '200') !== FALSE) {
echo 'boom';
}
problem server response:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, root#localhost 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.
all i am getting from the log they provide is:
[Wed Apr 24 20:36:01 2013] [warn] mod_fcgid: read data timeout in 60 seconds
[Wed Apr 24 20:36:01 2013] [error] [client 151.227.255.54] Premature end of script headers: php-cgi
Any advice is appreciated, as I'm a little stuck on what to do now.
Maybe I could reproduce it. But my environment uses mod_fcgid not simple cgi. Make sure the owner and group are the same as for the executing cgi user. Or for simplicity as all the other files in your webdirectory.
I am developing a wordpress theme and I want to use jQuery.load() to load data from a PHP file in my theme directory called process.php to a div in a wordpress page template.
I haven't had any issues with load() in the past but Wordpress is preventing me from loading the data or even accessing the process.php file in the browser.
When I navigate to the full path of the file (eg: http://[site]/[theme]/functions/process.php) I get the following error in Chrome
Internal Server Error.
The server encountered an internal error or misconfiguration and was
unable to complete your request.
Please contact the server administrator, **#gmial.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.
I've read similar questions but they involve modifying the .htaccess file. Does anyone know how to do this from a theme perspective ie: using $wp_rewrite.
EDIT
Linux Server error log states [Mon Mar 12 14:00:52 2012] [error] [client 121.98.81.237] SoftException in Application.cpp:245: File "/var/www/vhosts/****.co.nz/httpdocs/npr/wp-content/themes/_s_2/functions/process.php" is writeable by group
[Mon Mar 12 14:00:52 2012] [error] [client 121.98.81.237] Premature end of script headers: process.php
and this is process.php
<?php
echo "hello from php";
?>
I think the better way is use by init action and check the $_GET/$_POST, and return the string you want.. and if all ok, you can die() the script.
For this way you get access to wordpress db and all..
When I try to run my site it gives error as Internal Server error, when I refresh the page I get my result properly.The error page looks like this:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster#test.mywebsite.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.
I also checked error_log file on my server, it gives error as:
[Sat Jun 12 01:21:55 2010] [error] [client 117.195.6.76] File does not exist: /home/rohit25/public_html/test/500.shtml, referer: http://www.test.mysite.com/home.php
sometimes error can be;
[Sat May 29 19:35:12 2010] [error] [client 97.85.189.208] File does not exist: /home2/carlton/public_html/test/favicon.ico
Are there any changes required in configuration file, I also tried to involve this error code in custom error page, it shows error page, which could not resolve this issue.
Your urgent help will be greatly appreciated.
The two errors you posted from your log are 404 errors. You need to configure your server to report HTTP 500 errors, which are those Internal Server Errors causing the message above.