Php cant write to xml with 7000 Lines -


this question has answer here:

i have php script in can add text in fields. php script adds text in fields in 2 xml files. working good, if xml getting big (7000 lines xml), can't write anymore.

i changed php.ini this

max_execution_time = 300      max_input_time = 900     ;max_input_nesting_level = 64 ; maximum input variable nesting level memory_limit = 512m    

so problem caused php.ini or in php file. script work when delete piece of xml code.

here php

ini_set('default_charset', 'utf-8'); if(isset($_post['post']) && $_post['post']=='true')  {$file1content = '<?xml version="1.0"?> <channels>'; for($j=0; $j < $_post['total1']; $j++) {if(isset($_post['checkbox1'.$j]) && $_post['checkbox1'.$j]=="on") {$file1content .=" <channel> <title>".$_post['checkbox1'.$j.'_title']."</title> <img>".$_post['checkbox1'.$j.'_img']."</img> <info>".$_post['checkbox1'.$j.'_info']."</info> <url>".$_post['checkbox1'.$j.'_url']."</url> </channel>";}} $file1content .= "</channels>"; $filehandle = fopen($file1,"w"); fwrite ($filehandle, $file1content); fclose ($filehandle);   if (isset($_post['post']) && $_post['post']=="true" && $_post['title']!='') $filecontent = file_get_contents($file1); $filenewxml = " <title>".$_post['title']."</title> <img>".$_post['image']."</img> <info>".$_post['info']."</info> <url>".$_post['url']."</url>";    //place elemnt in right place  $pos=$_post['pos1'];    $alltags=explode("<channel>",$filecontent,strlen($filecontent)); if(count($alltags)==1) //if file empty {$filenewcontent='<?xml version="1.0"?> <channels> <channel>"'.$filenewxml.'</channel></channels>';}      $filehandle = fopen($file1,"w");  fwrite ($filehandle, $filenewcontent);  fclose ($filehandle);    <?php                      $content= file_get_contents($file1);                      $arr = simplexml_load_string($content);                      $i=1;                      foreach ($arr $element)                      {                           echo "<option value='$i'>$element->title</option>";                           $i++;                      }                         ?> 

to fix go php.ini , add this

max_input_vars = 3000 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -