php在Mac OS上超时

时间:2018-10-31 13:36:02

标签: php macos server

我正在一个非常复杂的Web应用程序上工作,该Web应用程序使用具有很多过程的功能,该功能似乎在基于Windows和Linux的OS上都可以运行,但是当我在Mac计算机(10.10 Yosemite)上尝试该功能时,它正在超时。我已经尝试将max_execution_time增加到300,但是没有用。

当我调查时,我在使用Mac的同时监视了服务器上的进程,发现php-cgi具有100%的CPU使用率,但是当我使用其他操作系统(如Ubuntu,Win10,Win7)时,它运行良好

我还在每个操作系统上使用相同的浏览器(Google Chrome)

mac os和其他操作系统之间是否有区别?还是将其他请求发送到使CPU使用率达到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 :(得分:0)

尝试更改apache配置:

设置:

Timeout 3600

它将起作用;