Importing csv problems - php

Hi I have problem with importing csv files into my magento 1.9 store. After pressing start this happens
I've checked apache error.log and this is error:
PHP Fatal error: Uncaught DivisionByZeroError: Modulo by zero in
C:\xampp\htdocs\magmi-git\magmi\engines\magmi_productimportengine.php:1134\nStack
trace:\n#0
C:\xampp\htdocs\magmi-git\magmi\engines\magmi_productimportengine.php(944):
Magmi_ProductImportEngine->processDataSourceLine(Array, 0,
1593608380.9801, 1593608380.9801, 0, 0)\n#1 C:\xampp\htdocs\magmi-git\magmi\inc\magmi_engine.php(454):
Magmi_ProductImportEngine->engineRun(Array)\n#2
C:\xampp\htdocs\magmi-git\magmi\web\magmi_run.php(36):
Magmi_Engine->run(Array)\n#3 {main}\n thrown in
C:\xampp\htdocs\magmi-git\magmi\engines\magmi_productimportengine.php
on line 1134, referer:
http://127.0.0.1/magmi-git/magmi/web/magmi.php?ts=1593608379
Next I looked up into line 1134 of magmi_productimportengine.php and this is the line which causes problems i think:
if ($this->_current_row % $rstep == 0) {
$this->reportStats($this->_current_row, $tstart, $tdiff, $lastdbtime, $lastrec);
}
So simply I have deleted it as well as extracting the line inside if to be executed always. It got rid of being stuck on Initialized attrribute_set_infos but here is another problem, which i can't resolve by myself.
So here I am asking for your help! Maybe one of you can help me?

Related

Wordpress Database Memory Error

I'm running a large Wordpress multisite install that, for each site, runs a number of database queries to display information in the respective blog. The data queries aren't too heavy however I often see this in my error log:
PHP Fatal error: Allowed memory size of 1572864000 bytes exhausted (tried to allocate 97 bytes) in /home/********/public_html/wp-includes/wp-db.php on line 1775
When this occurs I believe the page being called (that causes the error) stops loading and the user has to reload to access the information. I've been through every page being called an all load on their own without any issue.
Looking at the relevant line in the wp-db.php file this is the line that causes the error:
preg_match( '/^\s*(create|alter|truncate|drop)\s/i', $query ) ) {
$return_val = $this->result;
i.e. when a database query is being executed. Something is obviously going quite wrong here as I've tried upping my memory limit for php resources. Does anyone know how I would go about identifying what is causing this error so I can fix it?
Put following line of code in your wp-config.php file.
define( ‘WP_MEMORY_LIMIT’, ‘2000M’ ); // Value must be greater than current value
Please let me know if you need further help.
Thanks!

Clearing Cache In Magento Removes The Cart

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?

YShout 5: Function Unserialize Error

Bought YShout and have been running on my webserver for some time now. Support isn't answering any emails in a long time. I keep getting unserialize errors that kill the chat box.
Error: There appears to be a problem: unserialize() Error at offset 65537 of 86434 bytes. File: filestorage.class.php Line 36.
Here is the function with line 36 in it.
function load() {
if (($contents = $this->read($this->path)) == null)
return $this->resetArray();
return unserialize($contents);///////////line 36
}
here seems to be the line in the log file that is generating the error message, 65537 seems to be located right at the "a" in "uia:2:" in the string.
i:251;a:6:{s:8:"nickname";s:7:"TestUser";s:7:"message";s:30:"when he's online ask him";s:9:"timestamp";d:1373857811.6403610706329345703125;s:5:"admin";b:0;s:3:"uia:2:{s:4:"info";a:1:{s:15:"latestTimestamp";i:-1;}s:5:"posts";a:0:{}}ip";s:12:"76.174.54.75";}}
Not really sure how YShout works, but I'm getting this error more than once a day now. I have to delete the log file, then YShout creates a new log from scratch and all is well. But until I delete the log causing problems no one can use the chat window.
Ideal solution would be to fix this and figure out whats going on. Secondary solution would be to rename the log file causing the error. This would cause YShout to create a new log file to use and we would have a history of the log that contained the error message.
I had the same error message appearing when I was messing with the log file. If you add or remove characters from a message you'll end up with this error. But altering characters won't cause any trouble. So that means that YShout is storing message lengths in the log file.
Look at this line:
s:30:"when he's online ask him";
's' states that 30 characters are being used, but your message is only 24 characters long. Try changing it to 24 and the problem should be fixed.

phpseclib Warning: unpack() [function.unpack]: Type C: not enough inpu

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?

How to log calling line of code which produces an error

I get a notice from my php-script:
Undefined offset: 32 in C:\xampp\htdocs\WWW\myfilexyz.php on line 74
I want to detect where the error occurs as the procedure which produces the error is called many times.
I added the following line of code:
error_log("you made a mistake", 3, "errorfile.log");
Looking into errorfile.log, the message appears 3 times, but the procedure is called more than 100 times. How can I find the 3 lines where the error is produced?
I would like to see sometime like:
"you made a mistake, called from line 234 from start.php"
The easiest is to use a proper error handler which provides a stacktrace for each error. You can install xdebug, which outputs a lot more details about an error when activated. While you're at it, look into using xdebug to hook up a debugger (read xdebug's documentation).
Alternatively write your own error handler which uses debug_backtrace to give you a decent stacktrace.
$err = error_get_last();
error_log($err['message'] . ' in ' . $err['file'] . ' on line' . $err['line'], 3, "errorfile.log");

Categories