Search code examples
phpdomwebserverdomparsermemory-limit

Fatala Error in Php with DOM


I have html dom parser and php script to store the table data to mysql. Now I'm getting Fatal Error on line 18. Below is the code of line 18 and is for finding table from HTML Web Page. Also I had applied this script to so many same webpages of different sizes (in kb) and more content but same. Then I found that there is not any problem with the script as it works fine on less sized (like 100kb, 200kb) pages, while it not works with large sized pages having large data (like 800kb, 900kb). So I think there is limit in memory on my server. Please help me resolve this issue.

.......
foreach($html->find('table#GridView1') as $e){
.......

Solution

  • Finally after trying so many ways and giving 10 hours to this question, I got the solution. First changed the max_file_size limit in html DOM as tald by @Koen Hoeijmakers. Then the must important factor which we must need to improve in dedicated server having centos 5 and kloxo panel is to change all limits in .htaccess.. as below:

    php_value upload_max_filesize 2M
    php_value max_execution_time  300
    php_value max_input_time  600
    php_value memory_limit  320M
    php_value post_max_size  80M
    

    and got out of this hell(Error!!). No matter, thanks for your suggestions.