You are here:  » Import script


Import script

Submitted by Harvey on Tue, 2007-07-03 14:06 in

Hi,

I tried to import a feed with 865 odd products, and receive a internal 500 error. After some banter with the host, it turns out they cut off scripts automatically that use 99% CPU (I know, selfish aren't they?!).

Have you got any way to make magic parser uh, chill out a bit?

Cheers

Submitted by support on Tue, 2007-07-03 14:10

Hi Harvey,

Another use came across this problem with their hosting company. We put a 1 second sleep() in after importing every 100 products and this brought the CPU usage right down. To so this, in includes/admin.php, look for the last line of the import record handler function as follows (line 344 in 11/09A, 354 in 12/10A, 399 in 12/10B, 409 in 13/03A, 536 in 15/09A)

    return ($admin_importProductCount == $admin_importLimit);

Change this as follows:
    if (!($admin_importProductCount % 100))
    {
      sleep(1);
    }
    return ($admin_importProductCount == $admin_importLimit);

Hope this helps,
Cheers,
David.

Submitted by Harvey on Tue, 2007-07-03 15:08

Ah, thanks David.

Submitted by Harvey on Tue, 2007-07-03 15:40

Thanks for that.

Unfortunately it didn't seem to resolve my problem though.

I can import a feed with one product. I can import a feed of 1,000 products. But this feed, it won't import.

I've asked the merchant if the feed structure's changed at all - and it hasn't. I've even duplicated the feed and renamed it - it works.

The only reason could be that the host has blocked the URL "http://www.mysite.co.uk/admin/feeds_import.php?filename=firebox.csv"!

Any ideas?

Submitted by support on Tue, 2007-07-03 16:00

Hi Harvey,

"Premature end of script headers" basically means that PHP didn't even get going. The only other time I have come across this error is when a disk had failed and physically corrupted the source files. The user had to re-install the affected scripts and it then worked fine.

In this case, since you are able to import other feeds but not that specific feed, it does sound like your host has blocked that specific URL! It would be worth asking them if they have done this - and perhaps explain that you have changed your code to include a wait state during import, and ask them to release the block.

The alternative of course is to rename the firebox feed and then register / import it again - as this time the URL won't be blocked...

Hope this helps,
Cheers,
David.

Submitted by Harvey on Tue, 2007-07-10 10:43

Thanks David.