Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7839749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T15:32:21+00:00 2026-06-02T15:32:21+00:00

I wrote a PHP script which runs through a text file (actually it’s a

  • 0

I wrote a PHP script which runs through a text file (actually it’s a ‘list’ file from imdb) and stores it on my local MySQL database.

public static function updateMovies( $list ) {
    $offset = 15;               // movies.list start with movie names at line 16
    $handle = fopen($list, "r") or die("Couldn't get handle");
    if ($handle) {
        while (!feof($handle)) {
            $buffer = fgets($handle);
            if($offset!=0)
                $offset--;
            else
                if($buffer[0] != '"'){
                    $title = trim( substr( $buffer, 0, strpos( $buffer, '(' ) ) );
                    $year = intval(trim( substr( $buffer, strpos( $buffer,'(' )+1, 4 ) ));
                    Movie::create( $title, $year );
                }
        }
        fclose($handle);
    }
}

Since those list-files are up to 200MB it takes a lot of time. By Default PHP’s MAX_EXECUTION_TIME is set to 30 seconds.

I set this value to 300 just to try if it works. For example, my ‘movies.list’ file is around 80MB and using this script for 300 seconds created around 25000 lines in my database. This doesn’t work because I have not even reached the movies starting with ‘B’.

I know I can set the MAX_EXECUTION_TIME to 0 (unlimited) but in the future I don’t want this database to be on my localhost. I want it on my webserver and my webserver hosts MAX_EXECUTION_TIME is set to 90 as far as I know.

Any ideas how you would handle this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T15:32:23+00:00Added an answer on June 2, 2026 at 3:32 pm

    You may either:
    Use set_time_limit(sec)
    or (better) run your script from the command line through a cron entry. That way you will avoid many other non-php related timeout issues.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I write curl php script which work is download csv file from one website
I wrote a function which runs a php script and returns its output. I
I have a script that I wrote in PHP which scrapes data from a
I wrote a PHP script on my local server which needs to include path
I wrote a PHP script which will run every Monday using cron. In this
I wrote a bash script which can modify php.ini according to my needs. Now
I wrote a php script which outputs html files on the screen which uses
I have the following PHP script which runs nicely and inserts all the data
I wrote a small PHP script which does a branding on a present PDF
I have an app that runs on PHP 5.3 which stores passwords hashed using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.