XML in series

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
styvodiabolo
Forum Newbie
Posts: 13
Joined: Tue May 19, 2009 2:18 pm

XML in series

Post by styvodiabolo »

Hello,

I would like to create many xml files (100000 for testing step). Here is the code to create them :

Code: Select all

 
for($i=$start; $i<=NB_SQL_USER; $i++) {
    //Begin XML
    $user_account->set_u_id($i);
    $user_account->create();
    $user_info->set_u_id($i);
    $user_info->create();
    //End XML
    do {
        sleep(0.5);
    }while(!file_exists($path_xml_infos.$i.'.xml'));
}
 
I add the do/while instruction to be sure that the xml is really there.
The problem : PHP going (maybe) too fast and create only 11000 xml.

Do I join an option to manage the creation ?
Do you have any suggest ?

Thanks a lot.

Steve.
Last edited by Benjamin on Wed May 20, 2009 2:11 pm, edited 1 time in total.
Reason: Changed code type from text to php.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: XML in series

Post by Christopher »

You don't need the loop and it is probably making things worse. My guess is that the script is timing out at 11000. Check the php.ini setting for execution time. You can set it within the script for just that script.
(#10850)
styvodiabolo
Forum Newbie
Posts: 13
Joined: Tue May 19, 2009 2:18 pm

Re: XML in series

Post by styvodiabolo »

I've thought too that execution time was the pb but before the script, I've a couple of settings :

Code: Select all

 
set_time_limit(0);
ini_set('memory_limit','160M');
if(!ini_get('display_errors'))
    ini_set('display_errors', 1);
error_reporting(E_ALL);
 
arborint wrote:You don't need the loop and it is probably making things worse
How can I do without ?
Is an other way better to do the xml's serie ?

Steve.
Last edited by Benjamin on Wed May 20, 2009 3:05 pm, edited 1 time in total.
Reason: Changed code type from text to php.
Post Reply