Hello David,i change my hosting and now if i have a big feed the script don t import it into database but i just get the file php to download ?... {link saved} here u can see what appen,
And please,how can i build a script that import all feeds in the database with just one click, so i can put him in the cronjob to work automatic?
Im very noob on programming,i hope you can paste a snippet.
Thank you veryyyyy mutch!
Cheers
Stefano.
Hello David,i read before all of these tutorials,and my cron work perfectly with import.php,but import.php is used to import feed from remote server to my server,this file don t work for me to import thef feed into my mysql,i want know how to automatic cron feeds_import.php to import feed into mysql,in few words like a click simulation on /feeds_import.php?filename=yourfile.xml,i try to put this string in my cron but don t work :(.
Thank you
cheers
Stefano
Now the feeds_import work fine because i add a snippet that i find in the forum,but i have the problem with /feeds_register_step1.php?filename=feed.xml
when i click on it i get feeds_register_step1.php to download ,this appen with big feeds,i send to the hosting (siteground) an help request and they says:
"The Apache and the php timeout on all our servers is set to 30 seconds. This is the max time a php script should be executed for. If it exceeds this time the script will timeout. These settings are the optimal once for Shared Linux server and are the most secured once to keep the server from overloads. We cannot allow any overloads because from this all the accounts on the server will suffer from the low resources.
----------------------------------------
We have checked your script. however your ticket requires deeper development/web programming knowledge and that is why we are not able to assist you.
The best thing you can do is to contact a web developer, who will be able to help you fixing your problem."
Another thing you might consider is to contact the software developers of your application; they might be able to think of an easy fix for your problem(s). Having a look at the application's official forum might be useful for your needs too.
Note that if the script requires too long period of time to be executed your developer should create it to import the data in smaller parts. This way the time out should enough for each part.
--------------------------------------------------------
There is a solution to solve the problem with feed_register_step1.php ? May be the script fetch to mutch data before load the step2 script.can i frame datas or use just few kb before start step2? Thank you,im sorry if i ghive you some problems.
Cheers.
Stefano
Hello Stefano,
It looks like your host is saying you have maximum 30 seconds to run a script; which is not long enough to import very big feeds into MySQL.
Unfortunately, you can't split the import up because reading XML is a serial process - you cannot jump straight into it as it is the reading it that takes most of the time, not the inserting into MySQL!
One thing you can do is modify the import process process so that it will sleep for 1 second every 100 records, but this would still require the cooperation of your host to allow unlimited execution time for your account. Here are the mods, then I will show you what to ask your host.
In includes/admin.php at line 288 you will see:
return;
To insert the sleep state, change this as follows, so that the new code is executed before the admin__importRecordHandler() function returns:
if (!($admin_importProductCount % 100))
{
sleep(1);
}
return;
With this in place, you might want to ask your host something like this:
-------
I have contacted the developer of my script, but he says that it is not possible to split the process up because it is the parsing of the XML that takes the most time.
However, what he has done is show me how to make the script wait for 1 second every 100 records, which means that it will not overload the server at all.
I have made this modification, and so would it be possible for you to remove the PHP execution time limit on my account?
-------
Hope this helps,
Cheers,
David.
Hello Stefano,
Firstly, have a look through the following thread which has lots of information about time outs, how to identify what is causing it, and then what to do about it.
http://www.pricetapestry.com/node/582
With the file being offered for download, if this happens after exactly the same amount of time each time you try to import (e.g. 30 seconds); then it sounds like a web server imposed timeout. If it was a PHP timeout, you would see the message "Maximum execution time exceeded" instead of being offered the file for download.
--
There is already a script for you to import all feeds with CRON. It is scripts/import.php, and you call it like this for all feeds:
php import.php @ALL
Here are more details:
http://www.pricetapestry.com/node/7
And you will find example for using it within your CRON script in this thread:
http://www.pricetapestry.com/node/198
Cheers!
David.