I have searched this a lot and none of the solutions has worked so far, so I guess I really need to troubleshoot to see what the problem is:
When I browse our website www.theprinterdepo.com, it works fine on chrome, ie or firefox.
However when I go to the admin on www.theprinterdepo.com/admin on Internet explorer, then it shows the 500 internal server error, and after that if I try to use Internet Explorer to www.theprinterdepo.com, it shows the same error. At the same time I can be in Google Chrome or Firefox surfing the site and it works without a problem.
It takes ages to load on Internet Explorer when it works. while on chrome still loads perfect.
I set chmod 755 in index.php.
I added this on index.php
if ($_SERVER['REMOTE_ADDR'] == '83.134.93.212') { Mage::setIsDeveloperMode(true); ini_set('display_errors', 1); }
I got this
Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 60: parser error : Opening and ending tag mismatch: config line 28 and confg in /home/theprint/public_html/lib/Varien/Simplexml/Config.php on line 510
#0 [internal function]: mageCoreErrorHandler(2, 'simplexml_load_...', '/home/theprint/...', 510, Array)
#1 /home/theprint/public_html/lib/Varien/Simplexml/Config.php(510): simplexml_load_string('loadString('loadFile('/home/theprint/...')
#4 /home/theprint/public_html/app/code/core/Mage/Admin/Model/Config.php(59): Mage_Core_Model_Config->loadModulesConfiguration('adminhtml.xml', Object(Varien_Simplexml_Config))
Line 510 correspond to this:
public function loadString($string)
{
if (is_string($string)) {
$xml = simplexml_load_string($string, $this->_elementClass);
if ($xml instanceof Varien_Simplexml_Element) {
$this->_xml = $xml;
return true;
}
} else {
Mage::logException(new Exception('"$string" parameter for simplexml_load_string is not a string'));
}
return false;
}
Since your error is Opening and ending tag mismatch: one of the quickest way to debug this is to disable all custom module/layout.xml modification and then reenable them one by one, until you find the xml that causing this error.
by editing that config file I was able to ech the path and find the xml failing, the start tag was and the end tag was
I fixed that and then it started to work
Related
So basically I have been looking for a solution for like two days straight and nothing seems to be helping.
I am using Roundcube mail client with IMAP, postfixadmin and dovecot and whenever I try to upload attachments, I get an internal server error.
Here is something I managed to catch in logs:
[11-Nov-2021 01:41:27 UTC] PHP Fatal error: Uncaught TypeError: fclose(): Argument #1 ($stream) must be of type resource, null given in /var/www/roundcube/program/lib/Roundcube/rcube_imap_generic.php:430
Stack trace:
#0 /var/www/roundcube/program/lib/Roundcube/rcube_imap_generic.php(430): fclose()
#1 /var/www/roundcube/program/lib/Roundcube/rcube_imap_generic.php(1149): rcube_imap_generic->closeSocket()
#2 /var/www/roundcube/program/lib/Roundcube/rcube_imap.php(215): rcube_imap_generic->closeConnection()
#3 /var/www/roundcube/program/lib/Roundcube/rcube.php(1038): rcube_imap->close()
#4 /var/www/roundcube/program/include/rcmail.php(921): rcube->shutdown()
#5 [internal function]: rcmail->shutdown()
#6 {main}
thrown in /var/www/roundcube/program/lib/Roundcube/rcube_imap_generic.php on line 430
There are a lot of settings all around the server so if you think that you need some of them for debugging, just ask and I'll happily put them here
EDIT: I made a quick video with all the things going on. You can see that upload "failed" with internal server error message, but after refreshing the page, attachment is there and it's being sent with email, and after receiving that email, I can't see attachment preview in email, but when I click on it I can see it and download it.
After a few long days, I finally managed to figure this out on my own, and it's really simple. So what's happening is that rounducbe is trying to close file that doesn't exist.
So, to all of you who are facing with the same problem, to fix this you have to edit file "path/to/roundcube/program/lib/Roundcube/rcube_imap_generic.php" on line 430
Change this:
protected function closeSocket()
{
#fclose($this->fp);
$this->fp = null;
}
Into this:
protected function closeSocket()
{
if($this->fp){
#fclose($this->fp);
}
$this->fp = null;
}
I'm having the following PHP code block:
if (file_exists($name)) {
$reader = new XMLReader();
$reader->open($name);
$reader->setSchema('inc/schema.xsd');
while($reader->read());
$reader->close();
} else {
die("you're having trouble with the files!");
}
For certain URLs I'm getting the following error:
Warning: XMLReader::read(): Unimplemented block at
..\xmlschemas.c:28351 in xml2csv.php on line
43
Warning: XMLReader::read(): An Error Occurred while reading in
xml2csv.php on line 43
Warning: DOMDocument::load(): Premature end of data in tag Products
line 1 in products.xml, line:
532571 in xml2csv.php on line 55
Mostly, the URLs that give me this problem are local URLs (when $name = "file.xml") or remote URLs (when $name = "http://www.domain.com/products.xml") are broken (returning 404, 500, etc.).
A simple Google search on the error brought me to this: https://github.com/Chronic-Dev/libxml2/blob/master/xmlschemas.c
At the line mentioned, 28351, it seems there's a text saying TODO. Because my C skills are very limited (as in close to nothing), I'd like to better understand the reasons of this error and how can I avoid bumping into it.
As XMLReader states, open method return boolean, which is TRUE in case of success and FALSE in case of failure. You may want to try the snippet below?
if (file_exists($name)) {
$reader = new XMLReader();
if ($reader->open($name)) {
$reader->setSchema('inc/schema.xsd');
while($reader->read());
$reader->close();
}
} else {
die("you're having trouble with the files!");
}
I've inherited a Magento project and needed only to change the value of two config variables, both payment URLs in table core_config_data.
I did so easily, but the old values persisted when loading the payment button pages. I then attempted to clear the cache by running the following:
$mage_filename = 'app/Mage.php';
require_once $mage_filename;
umask(0);
Mage::run();
Mage::app()->cleanCache();
Now the link to the Shopping Cart is gone from the main UI. I also get 404s when attempting to add items to the cart. When displaying product pages I receive the following error message:
Fatal error: Call to a member function addExcludeProductFilter() on a non-object in /home/rcspaces/public_html/shop/app/code/core/Mage/Catalog/Block/Product/List/Upsell.php on line 61
Please offer any suggestions you may have to help recover. Thanks.
open all your log files in magento, apache, system log and exception log. Chances are one of your xml files is corrupted.
then, if you notice a error like this one:
2014-03-12T06:15:28+00:00 ERR (3): Warning: simplexml_load_string(): Entity: line 1: parser error : XML declaration allowed only at the
start of the document in /var/www/magento1/lib/Varien/Simplexml/Config.php on line 510
2014-03-12T06:15:28+00:00 ERR (3): Warning: simplexml_load_string(): in /var/www/magento1/lib/Varien/Simplexml/Config.php on line 510
2014-03-12T06:15:28+00:00 ERR (3): Warning: simplexml_load_string(): ^ in /var/www/magento1/lib/Varien/Simplexml/Config.php on line 510
open up /var/www/magento1/lib/Varien/Simplexml/Config.php, navigate to line 510 and modify loadString function to look lie this:
public function loadString($string)
{
if (is_string($string)) {
$xml = simplexml_load_string($string, $this->_elementClass);
if ($xml instanceof Varien_Simplexml_Element) {
$this->_xml = $xml;
return true;
} else {
Mage::log($string);
}
} else {
Mage::logException(new Exception('"$string" parameter for simplexml_load_string is not a string'));
}
return false;
}
then, clear cache (can use 'rm -rf /var/www/magento1/var/cache/' unix command) and check system log again. You should see the content of the broken xml file. fix it comparing to vanilla magento files and you should be good. my broken xml was /var/www/magento1/app/code/core/Mage/Checkout/etc/config.xml
when I reproduced the error here.
once this is working, make sure to remove the else with Mage::log($string) from the Config.php file you modified earlier.
It sounds like you're missing server rewrite rules (.htaccess if you're on apache).
What version of Magento are you on?
Some SFTP credential works fine for below open source, but some credential throwing below error. what is the root cause for the below error, i saw some threads they posted some workouts, but those solutions does not worked for me.
Why i am getting below error, what will be the solution.
open source: phpseclib
Error: Bellow Error
Warning: unpack() [function.unpack]: Type C: not enough input, need 1, have 0 in \Net\SSH2.php on line 1469
Warning: extract() expects parameter 1 to be array, boolean given in \Net\SSH2.php on line 1469
https://github.com/phpseclib/phpseclib/blob/master/phpseclib/Net/SSH2.php#L1538
What is on your line 1469? The version you linked to has this on line 1469:
while ($this->decrypt_block_size > strlen($iv)) {
Your link is to line 1538, which is this:
break;
If you could post the three lines before and after, too, that'd be great.
Thanks!
I know this is an older question and it's been down-rated, but I am actually having the same error. It happens intermittently, so it's hard to troubleshoot. My errors are referencing line 2127 of \Net\SSH2.php. Here is that line, plus a few surrounding lines:
2121 $response = $this->_get_binary_packet();
2122 if ($response === false) {
2123 user_error('Connection closed by server');
2124 return false;
2125 }
2127 extract(unpack('Ctype', $this->_string_shift($response, 1)));
2129 switch ($type) {
2130 case NET_SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ: // in theory, the password can be changed
2131 if (defined('NET_SSH2_LOGGING')) {
This is the syntax that I'm using to copy a file from an external server to my own after logging in:
$sftp->get('/remote/file/path/file.csv', 'myfile.csv');
Here's the link to the page: https://files.maf.org/mp/forms/ChangePL.php
Actually, that page isn't accessed directly normally, but inside an iframe via https://www.maf.org/change
I will say that I've never produced the error when going to the direct link; only accessing it from the parent page via the iframe. Why would that be the case?
I don't know what's going on with my PHP. I'm using a bunch of classes and a semi-MVC framework that I developed myself (as an experiment). So the PHP file is including a lot of class files.
My PHP line numbers for error messages are completely off and therefore useless and making it impossible for me to debug. For example, right now I'm getting an error message that says:
`Parse error: syntax error, unexpected ')' in /view.php on line 209
The only problem is: there is no ')' anywhere near line 209. Even worse, if I put die() on line 200 or so, it still gives me an error message, now pushed down to line 210. So clearly the line of code is being taken into account, yet for some reason it's not dying.
Another thing is, it's including a header.php file prior to this line. The header file basically just outputs some HTML, and works fine on other pages. Yet on this page, it doesn't even output the header; it's just dying with a blank page and that error message.
Is there anything I can do to use more reliable debugging? If I could have an accurate line number, I'm sure I'd find the bug easily.
Edit: I found the bug. The point of this question is not to solve the unexpected ')' bug. The point is: why are the line numbers inaccurate? The actual error message was on line 218, not 209 or 210.
It's your line endings. Open up a program where you can change the line endings and change it to that of the server and the line number will be correct. I don't know about windows, but on mac you can change line endings using TextWrangler (or BBEdit) and on linux using gedit.
Try adding a Logging function with a simple stacktrace.
Use it:
<?php
require_once("Log.class.php");
$myLog = new Log();
$log->write("Tag here", "Details here");
?>
Log.class.php:
<?php
$debugFolder = "/";
class ExpectedParamaterUndefinedException extends Exception {}
class Log {
private $logs = array();
function __contruct(){
}
function write($type, $message){
$trace=debug_backtrace();
$caller=array_shift($trace);
$fileParts = explode("/", $caller['file']);
$filePieces = explode(".", $fileParts[count($fileParts) -1]);
$this->logs[ $filePieces [count($filePieces ) - 2] ] .= " [ ".date(DATE_RFC822)." ] [ $type ] [Line : ".$caller['line']."] ::: $message \n ";
}
function __destruct(){
foreach($this->logs as $caller => $log){
$fp=fopen($debugFolder . "debug/" . $caller.".log", "a");
fwrite($fp, $log);
fclose($fp);
}
}
}
?>
You will end up with a .log file for each class that you log.
Happy hunting!