问题
Possible Duplicate:
500 - An error has occurred! DB function reports no errors when adding new article in Joomla!
I have an article that I want to publish on my Joomla! site. Every time I click apply or save. I get error 500 - An error has occurred! DB function reports no errors
. I have no idea why this error comes up, al I can think is that it's a server error.
I'm using TinyMCE to type articles together with Joomla! 1.5.11.
Updated: I turned on Maximum error reporting in Joomla! and in the article manager I tried to save the article and got these couple of errors. Please check screenshot
(source: techportal.co.za)
I tried adding
<?php
ini_set('error_reporting', E_ALL);
error_reporting(E_ALL);
ini_set('log_errors',TRUE);
ini_set('html_errors',TRUE);
ini_set('display_errors',true);
?>
at the top of the index.php pages for Joomla! but it does not show any errors. I checked the error logs on the server and also no errors come up.
I managed to publish the article via phpMyAdmin but then something else happens. I try to access to article from the front end, by clicking on the link to the article, but only a blank page comes up.
This is really weird, since the error log does not show any information. So I assume the error needs to be coming from Joomla!
This happens if I add a print_r($_POST) before if (!$row->check()) {
Array
(
[title] => Test.
[state] => 0
[alias] => test
[frontpage] => 0
[sectionid] => 10
[catid] => 44
[details] => Array
(
[created_by] => 62
[created_by_alias] =>
[access] => 0
[created] => 2008-10-25 13:31:21
[publish_up] => 2008-10-25 13:31:21
[publish_down] => Never
)
[params] => Array
(
[show_title] =>
[link_titles] =>
[show_intro] =>
[show_section] =>
[link_section] =>
[show_category] =>
[link_category] =>
[show_vote] =>
[show_author] => 1
[show_create_date] => 0
[show_modify_date] => 0
[show_pdf_icon] =>
[show_print_icon] =>
[show_email_icon] =>
[language] =>
[keyref] =>
[readmore] =>
)
[meta] => Array
(
[description] => Test.
[keywords] => Test
[robots] =>
[author] => Test
)
[id] => 58
[cid] => Array
(
[0] => 58
)
[version] => 30
[mask] => 0
[option] => com_content
[task] => apply
[ac1e0853fb1b3f41730c0d52de89dab7] => 1
)
回答1:
The exception is being thrown here in /administrator/components/com_content/controller.php
(around 693)
if (!$row->check()) {
JError::raiseError( 500, $db->stderr() );
return false;
}
The check()
function only returns false in two cases: either the title
or the introtext
are empty.
What I would do in your case is edit the controller.php
file above and echo a var_dump
of $row
before the error is raised. It might be that no data is coming in from $_POST
.
Edit: It looks like there's no body of your article being sent through in your $_POST
. This is most likely because of something to do with the form which is submitting the data. On the page where you are trying to create the article, take a look at the HTML source. In my Joomla installation, the textarea is named "text"
. Make sure it has that name, and that nothing else in that form is named "text"
.
回答2:
500 errors are often a fatal error caused by PHP. Your server probably has error displaying disabled because users shouldn't see these errors.
Put this somewhere in your php code and check if you see any PHP errors:
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
?>
回答3:
It's a fatal server error. We cannot solve your problem until we know what the error message is, so the first step is to look through the log files and turn on debug output to see what the error message is.
To enable all debug output add the following code to the top of your page:
<?php
ini_set('error_reporting', E_ALL);
error_reporting(E_ALL);
ini_set('log_errors',TRUE);
ini_set('html_errors',TRUE);
ini_set('display_errors',true);
?>
It looks like you are trying to add a content article in the admin.
In components/com_content/controller.php on like 693 we see an error is raised because the data you tried to save was not valid. Either you have installed a extension that is messing up joomla, or by some other method the system is not stable.
I recommend removing extensions; if that doesn't help, reinstall Joomla to fix your problem.
来源:https://stackoverflow.com/questions/1239975/db-function-reports-no-errors-when-adding-new-article-in-joomla