Jump to content

Fatal error: Maximum execution time of 60 seconds exceeded in ...


Jragon

Recommended Posts

Hey,

 

I'm getting an error:

Fatal error: Maximum execution time of 60 seconds exceeded in C:\xampp\htdocs\test.php on line 11

 

My code:

<?php
$file = fopen ('C:\xampp\htdocs\GDict.txt', 'r');
$i = 0;
while(!feof ($file)) {
    $load[$i] = fgets($file, 1024);
    mysql_connect("localhost","root","");
    mysql_select_db("md5");
    $word = $load[$i];
    $md5 = md5($word);
    mysql_query("INSERT INTO md5 VALUES ('$md5', '$word');");
    $i++;
    $limit = count($load);
    $width2 = $limit;
}
fclose($file);
echo '[o] Loaded' . $limit .  'word. <br />';
echo '<br />Done.';
?>

 

 

I have tried changing the php.ini file.

max_execution_time = 60

To

max_execution_time = 30000000000000

 

But that still dosent work.

 

Any help would be loved

 

Thanks

 

Jragon

 

Link to comment
Share on other sites

Your code is written poorly.

 

Move these lines

<?php
    mysql_connect("localhost","root","");
    mysql_select_db("md5");
?>

outside the loop.

 

Why are you using the array $load? It serves no purpose.

 

What is in the file? And how many records? If you have one item per record, here's how I would do this:

<?php
mysql_connect("localhost","root","");
mysql_select_db("md5");
$load = file('C:\xampp\htdocs\GDict.txt');
foreach ($load as $word) {
   $word = trim($word);
   $q = "INSERT INTO md5 VALUES ('" . md5($word) . "', '$word')";
   $rs = mysql_query($q) or die("Problem with the query: $q<br>" . mysql_error());
}
echo '[o] Loaded' . count($load) .  'words. <br />';
echo '<br />Done.';
?>

 

Ken

Link to comment
Share on other sites

With the new one i get the error:

 

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 24 bytes) in C:\xampp\htdocs\md5\mkdbw.php on line 4

 

 

But with the old one i manage to get 29,000 results

 

If you want to download all my word lists go here:

http://www.mediafire.com/?3i0y2e85o2thuk9

 

Thanks

 

Jragon

 

Link to comment
Share on other sites

How big is your file? It sounds like it's very large. If it is, change my code like this:

<?php
mysql_connect("localhost","root","");
mysql_select_db("md5");
$file = fopen ('C:\xampp\htdocs\GDict.txt', 'r');
$i = 0;
while (!feof ($file)) {
   $word = trim(fgets($file, 1024));
   $q = "INSERT INTO md5 VALUES ('" . md5($word) . "', '$word')";
   $rs = mysql_query($q) or die("Problem with the query: $q<br>" . mysql_error());
   $i++;
}
fclose($file);
echo '[o] Loaded' . $i .  'words. <br />';
echo '<br />Done.';
?>

 

Ken

Link to comment
Share on other sites

MySQL sintax error:

Problem with the query: INSERT INTO md5 VALUES ('3590cb8af0bbb9e78c343b52b93773c9', ''')

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '''')' at line 1

 

I cant see anything worng with it.

Link to comment
Share on other sites

If this is the message:

INSERT INTO md5 VALUES ('3590cb8af0bbb9e78c343b52b93773c9', ''')

The second value is a single quote.

 

Are there any works in your file that have single quotes in them? Or are single quotes?

 

Try replacing this line

<?php
$q = "INSERT INTO md5 VALUES ('" . md5($word) . "', '$word')";
?>

with

<?php
$q = "INSERT INTO md5 VALUES ('" . md5($word) . "', '" . mysql_real_escape_string($word) . "')";
?>

 

Ken

Link to comment
Share on other sites

Its now working =]

 

but still the same error:

 

Fatal error: Maximum execution time of 60 seconds exceeded in C:\xampp\htdocs\md5\mkdbw.php on line 7

 

Is there anyway to stop this?

 

 

Thanks

 

Rory

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.