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

  • SEARCH
  • Home
  • 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 3481642
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:28:12+00:00 2026-05-18T10:28:12+00:00

I know people complain usually about scripts not working, but here is a case

  • 0

I know people complain usually about scripts not working, but here is a case where it keeps working even if I want it to stop.

I have a CSV parser that analyzes lines and inserts entries in a DB table. I am using PDO and Zend Framwork for the project. The code works fine.. too fine in fact.

public function save()
{
    $memory_limit = ini_get('memory_limit');
    ini_set('memory_limit', '512M');

    $sql = "
        INSERT INTO my_table (
            date_start,
            timeframe,
            type,
            country_to,
            country_from,
            code,
            weight,
            value               
        ) VALUES (?,?,?,?,?,?,?,?)
        ON DUPLICATE KEY UPDATE 
            weight = VALUES(weight),
            value = VALUES(value)
    ";
    if ($this->test_mode) {
        echo $sql;
        return;
    }
    $stmt = new Zend_Db_Statement_Pdo($this->_db, $sql);
    foreach($this->parsed_data as $entry){
        $stmt->execute(array_values($entry));
        $affected_rows = $stmt->rowCount();
        if ($affected_rows){
            $this->_success = true;
        }
    }
    unset($this->parsed_data, $stmt, $sql);
    ini_set('memory_limit', $memory_limit);
}

The script takes various seconds to complete as I am parsing a big file. The problem appears when I am trying to stop the script, with ESC or even by closing the page. The script does not stop until it finishes to insert all entries. Not even an Apache reload is not fixing this, probably a restart will do it.

I am thinking that this is not normal behaviour and maybe I am doing something wrong so I am asking for suggestions.

Thanks.

UPDATE
ignore_user_abort is off (default behaviour) so user abort should be considered..

  • 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-05-18T10:28:13+00:00Added an answer on May 18, 2026 at 10:28 am

    I’m pretty sure that’s standard PHP behaviour – just because the browser goes away doesn’t mean it won’t stop processing the script. (Although restarting Apache, etc. will achieve this goal.)

    To change this behaviour, you can use ignore_user_abort.

    That said, “PHP will not detect that the user has aborted the connection until an attempt is made to send information to the client“, which I suspect may be the issue you’re experiencing.

    See the above link and the PHP runtime configuration information for more info.

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

Sidebar

Related Questions

I'm not sure if many people know about this text-editor? jEdit was kinda big
I know many people who use computers every day, who do not know how
I'd like know what people think about using RAISERROR in stored procedures to pass
I think most people know how to do this via the GUI (right click
Curious to know how people set up their personal and/or work development environment, in
As I think most people know already, or if you don't, FPDF released a
I will choose Java as an example, most people know it, though every other
I know that most people recommend using HttpRuntime.Cache because it has more flexibility... etc.
To all the people who know lambda calculus : What benefit has it bought
I am interested to know what strategies people have to keep their code AND

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.