тайм-аут php на Mac OS - PullRequest
       9

тайм-аут php на Mac OS

0 голосов
/ 31 октября 2018

Я работаю над очень сложным веб-приложением, которое использует функцию с большим количеством процессов, эта функция работает как на Windows, так и на ОС Linux, но когда я попробовал ее на компьютере Mac (10.10 Yosemite), это истекло время ожидания , Я уже пытался увеличить max_execution_time до 300, но это не сработало.

Во время расследования я наблюдал за процессом на сервере при использовании Mac и обнаружил, что php-cgi использует процессор на 100%, но когда я использую другие ОС, такие как Ubuntu, Win10, Win7, он работает нормально.

Я также использую один и тот же браузер (Google Chrome) в каждой ОС

Есть ли разница между Mac OS и другими ОС? или это отправка других запросов на сервер, который сделал использование процессора 100%.

вот функция, вызывающая этот тайм-аут. и я использую codeigniter

$uid = $amember_user['user_id'];



    if(isset($_POST["ptnt"])){
        $savestype = "patent";
        $result = $_SESSION["modified_ids"];    
    } else {
        $result = $_SESSION["t_modified_ids"];  
        $savestype = "trademark";
    }

    $type = $this->input->post("type"); 
    switch ($this->input->post("save_type")) {
        case 2:
            $savetype = 0;
        break;
        case 3:
            $savetype = 0;
        break;
        default:
            $savetype = $this->input->post("save_type");
            break;
    }

    $resname = $this->input->post("resname");
    $details = array("type"=>$this->input->post("search_type"),
                    "name"=>htmlspecialchars($this->input->post("resname")),
                    "save_type"=>$savetype,
                    "published"=>$this->input->post("published_res"),
                    "query"=>$this->db->escape_str($this->input->post("resquery")),
                    "user_id"=>$uid,
                    "share_opt"=>$this->input->post("shareopt"),
                    "share_email"=>htmlspecialchars($this->input->post("shareemail")),
                    "sched_type"=>$this->input->post("schedtype"),
                    "notes"=>htmlspecialchars($this->input->post("saved_note")),
                    "records"=>count($result),
                    "security"=>$this->input->post("security"),
                    "security_code"=>$this->input->post("securitycode"),
                    "link"=>$this->input->post("url"),
                    "date"=>strftime("%Y-%m-%d %H:%m",strtotime("now"))
                    );
                    $amnamef = $amember_user['name_f'];
                    $amnamel = $amember_user['name_l'];
    $content = "<h3>Hello,</h3><p><strong>{$amnamef} {$amnamel}</strong> shared a PTODirect Search Link with you for the search titled <strong>{$resname}</strong></p>";
    $content .= "<strong>".$this->input->post("saved_note")."</strong>";
    $content .= "<p>Click on the link below or paste it into a browser to view the Search Result.</p>";

    $email = $this->input->post("shareemail");
    if(isset($_POST['uid'])){
        $details['orig_id'] = $this->input->post("uid");
    }
    $this->db->insert("save_result",$details);
    $id = $this->db->insert_id();
    $content .="<p><a href='".$this->input->post("url")."'>".$this->input->post("url")."</a></p><br/>";

    $urlpath = $_SERVER['HTTP_HOST']."/saved/unsubscribe/". base64_encode($this->input->post("shareemail"));

    $mailpost = base64_encode($this->input->post("shareemail"));


    $scode = $this->input->post("securitycode");
    if($id){
        if($this->input->post("shareopt") != "do not share"){
            if($this->input->post("security")=="share with link and password"){
                $content .= "<p>PASSWORD: <strong>{$scode}</strong></p>"; 
            }
            if($this->input->post("shareemail")!=""){
                if($emailunsubscribe != 1) // do not sent email if emailunsubscribe == 1 
                {

                    $share_email = $this->input->post("shareemail");
                    $email = explode(",",$share_email);
                    $content .="Create a free account on PTODirect to save this Search Result and perform your own United States Patent, Trademark and Copyright searches.  Just click on the link above after you've created the free account to see the save options.<br>";



                    foreach($email as $e){
                        $content .= "<br /><br /><img src='http://ptodirect.com/info/wp-content/uploads/2015/09/logo.png'><br />";
                        $content .= "<a href='ptodirect.com'>www.ptodirect.com</a>";
                        $content .= "<p style='color:#333;font-size:10px;'>You are receiving this message because someone Shared the search result with you'>EMAIL PREFERENCES</a> link.</p>";
                        $mail = $this->mailer($content,$e,"Someone shared a PTODirect search result with you!");
                        if($mail){
                            $this->db->insert("save_result_email",array("saveres_id"=>$id,"email"=>$e,"status"=>1));
                        }else{
                            $this->db->insert("save_result_email",array("saveres_id"=>$id,"email"=>$e,"status"=>0));
                        }
                    }
                }
            }
        }

        $qr = array();
        if($this->input->post("save_type")==0){
            if(isset($_POST["ptnt"])){
                foreach($result as $r){
                    $this->db->query("INSERT save_result_detail SET result_id=$r, save_result_id=$id, status_change=''");
                }
            } else {
                foreach($result as $r){
                    $this->load->model("ScheduleSearch_model","ssm");
                    $get_it = $this->ssm->get_insert_ids($r);
                    $stat_d = $get_it[0]->status_date;
                    $this->db->query("INSERT save_result_detail (result_id, save_result_id, status_change) VALUES ($r, $id, $stat_d)");
                }
            }

        }
        else
        {
                if(isset($_POST["ptnt"])){
                foreach($result as $r){
                    $this->db->query("INSERT save_result_detail SET result_id=$r, save_result_id=$id, status_change=''");
                }
            } else {
                foreach($result as $r){
                    $this->db->query("INSERT save_result_detail SET result_id=$r, save_result_id=$id, status_change=''");
                }
            }

        }



        if($_POST["dosched"]==1){
            switch($_POST['schedfrequency']){
                case "Once":
                    $nexttrigger = strftime("%Y-%m-%d",strtotime($this->input->post("schedstartdate")));
                break;
                case "Daily":
                    $nexttrigger = strftime("%Y-%m-%d",strtotime("+1 day",strtotime($this->input->post("schedstartdate"))));
                break;
                case "Weekly":
                    $nexttrigger = strftime("%Y-%m-%d",strtotime("+7 days",strtotime($this->input->post("schedstartdate"))));
                break;
                case "Monthly":
                    $nexttrigger = strftime("%Y-%m-%d",strtotime("+1 month",strtotime($this->input->post("schedstartdate"))));
                break;
                case "Yearly":
                    $nexttrigger = strftime("%Y-%m-%d",strtotime("+1 year",strtotime($this->input->post("schedstartdate"))));
                break;
            }
            $arr = array(
                        "name"=>htmlspecialchars($this->input->post("resname")),
                        "email"=>$amember_user['email'],
                        "frequency"=>$this->input->post("schedfrequency"),
                        "schedule"=>strftime("%Y-%m-%d",strtotime($this->input->post("schedstartdate"))),
                        "query"=>$this->db->escape_str($this->input->post("resquery")),
                        "last_triggered_schedule"=>"",
                        "next_trigger_sched"=>$nexttrigger,
                        "sched_type"=>$this->input->post("schedtype"),
                        "type"=>$savestype,
                        "saved_id"=>$id,
                        "user_id"=>$uid,
                        "status"=>1
                        );
            $this->db->insert("search_schedules",$arr);
            $sid = $this->db->insert_id();
            echo "<span style='color:blue; font-weight:bold;'>Schedule and Save result successful.</span>";
        }else{
            echo "<span style='color:blue; font-weight:bold;'>Search result successfully saved.</span>";        
        }
    }
    unset($_SESSION["t_modified_ids"]);
    $_SESSION['managedid'] = 0;

t_modified_ids имеет только 5 значений массива array(12345,54321,12322,11112,44421)

1 Ответ

0 голосов
/ 31 октября 2018

попробуйте изменить конфигурацию apache:

набор:

Timeout 3600

это будет работать;

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...