2016-12-17 3 views
0

문제점이 있습니다. 서버 문제인지 또는 코딩 중인지 모릅니다. 문제는 내가 이미지를 업로드하는 것과 함께 데이터베이스에서 일부 변경 (삽입, 업데이트, 삭제)을하면 오류가 발생한다. [sitename]이 현재이 요청을 처리 할 수 ​​없다는 것입니다. 그러나 이미지를 업로드하지 않고 트랜잭션을 만들면 모든 것이 잘됩니다.서버가 현재이 요청을 처리 할 수 ​​없습니다.

그러나 또 다른 이유는 내가 혼란 스럽다. 내 사이트에는 관리 패널도있다. 이미지와 데이터를 업로드하면 모든 것이 작동하지만 이미지와 함께 데이터를 업로드하면 오류가 발생한다. 문제가있는 곳을 모른다. 그것은 서버 측 문제이거나 제 코드에 있습니다.

다음은 사용자 측에서 사용중인 코드입니다.

public function partner_register() { 

     $date = date('Y/m/d'); 
     $this -> form_validation -> set_rules('contact', 'person contact', 'required|xss_clean'); 
     $this -> form_validation -> set_rules('company', 'company name', 'required|xss_clean'); 
     $this -> form_validation -> set_rules('ph', 'phone', 'required|xss_clean'); 
     $this -> form_validation -> set_rules('email', 'email', 'required|valid_email|is_unique[partner.email]|max_length[100]|xss_clean'); 

     $contact = $this -> input -> post('contact'); 
     $email = $this -> input -> post('email'); 
     $phone = $this -> input -> post('ph'); 
     $name = $this -> input -> post('company'); 
     $brand = $this -> input -> post('brand'); 

     if($brand == null or empty($brand) or $brand == "") { 
      ?> <script> alert('Select atleast one brand'); 
         window.location = "<?php echo base_url('register'); ?>"; 
       </script> 
      <?php 
     } 

     else if ($this -> form_validation -> run() == FALSE) { 
      ?> <script> alert('Email already exists. Please try new email.'); 
         window.location = "<?php echo base_url(); ?>"; 
       </script> 
      <?php 
     } 
     else { 
      $info = $this -> Parts_Model -> partner_register([ 
       'contact' => $contact, 
       'email'  => $email, 
       'company' => $name, 
       'phone'  => $phone, 
       'reg_date'  => $date, 
      ]); 
      if($info) { 
       foreach($brand as $key => $value) { 
        $brands = $this -> Parts_Model -> partner_brands([ 
         'partner_id' => $info, 
         'brands' => $value, 
        ]); 
       } 
       if($brands) { 
        ?> <script> alert('Subscription successfull.'); window.location = "<?php echo base_url('register'); ?>"; </script> <?php 
       } 
      } 
      else { 
       ?> <script> alert('Subscription failed.'); window.location = "<?php echo base_url('register'); ?>"; </script> <?php 
      } 
     } 
    } 

여기 백엔드에서 사용되는 코드는 모두 거의 동일합니다. 여기

 public function add_ads() { 

     $this -> header_template(); 
     $this -> form_validation -> set_rules('link', 'ad link', 'required|xss_clean'); 
     $this -> form_validation -> set_rules('schedule', 'start date', 'required|xss_clean'); 
     $this -> form_validation -> set_rules('end_schedule', 'end date', 'required|xss_clean'); 

     $link = $this -> input -> post('link'); 
     $schedule = $this -> input -> post('schedule'); 
     $end_schedule = $this -> input -> post('end_schedule'); 

     $config['upload_path'] = 'ads/'; 
     $config['allowed_types'] = 'jpg|jpeg|png'; 
     $config['encrypt_name'] = true; 
     $this -> load -> library('upload', $config); 

     if($this -> form_validation -> run() == false) { 
      echo validation_errors(); 
     } 
     else { 
      if(!$this -> upload -> do_upload('ad')) { 
       ?> <script> alert('<?php echo $this -> upload -> display_errors(); ?>'); window.location = "<?php echo base_url('dashboard/ads'); ?>"; </script> <?php 
      } 
      else { 
       $data = $this -> upload -> data(); 
       if($data['file_name'] and $data['full_path']) { 
        $file_name = $data['file_name']; 
        $file_path = $config['upload_path'].$file_name; 
        $info = $this -> Dashboard_Model -> add_ads([ 
         'add_link'   => $link, 
         'schedule'   => $schedule, 
         'end_schedule'   => $end_schedule, 
         'ads'    => $file_path, 
        ]); 
        if($info) { 
        ?> 
         <script> alert('Added Successfully.'); window.location = "<?php echo base_url('dashboard/ads'); ?>"; </script> 
        <?php 
        } 
        else { 
         echo 'Error! While adding brands.'; 
        } 
       } 
      } 
     } 
    } 

그리고

Server Error Image

그리고 여기가 서버 로그 오류 오류 로그를 기반으로

Log Errors

+0

메모리 제한 문제가 있으며 PHP가 메모리 사용량에 할당 한 것 이상인 것으로 보입니다. 이 링크를 확인하십시오. http://stackoverflow.com/questions/19508313/memory-limit-1024m-still-cannot-allocate-memory-couldnt-create-child-proce. – Perumal

+0

어떤 종류의 메모리 디스크 스토리지 또는 무엇입니까? –

+0

많은 메모리를 차지하고있는 지점을 확인할 수 있습니까 –

답변

0

있는 서버 오류를, 그것은 서버 자원처럼 보인다 더 이상 요청을 처리 할 수 ​​없습니다.

PHP의 실제 메모리가 스크립트를 처리하기에 충분하지 않으면 웹 서버가 새 하위 프로세스를 생성 할 수 없어 HTTP 500 오류가 발생합니다.

실제 서버를 사용하는 경우 실제 메모리를 조사해야합니다. VM에서 실행중인 경우 VM에 더 많은 메모리를 할당하십시오.

+0

그는 공유 호스팅을 사용합니다. 그는 공유 호스팅 서비스의 관리자에게 연락하지 않는 한 물리적 메모리를 VM으로 늘릴 수 없습니다. – Perumal

+0

내 메모리 사용량을 확인한 결과 사용 가능한 1.4GB의 0 % 사용량을 보여 주었는데 이는 메모리 사용에 문제가 없음을 의미합니다. –

+0

VM에 할당 된 메모리 제한이 아닙니다. 그것은 PHP에 할당 된 메모리 제한에 관한 것입니다. 한 가지해라. PHP에 할당 된 메모리 양을 확인하려면'echo ini_get ('memory_limit');를 작성하고 페이지에 인쇄 된 내용을 확인하십시오. 일부 공유 웹 호스팅 서비스 제공 업체는 PHP의 메모리 한도를 실제 128M보다 낮게 설정합니다. 귀하의 경우 웹 호스팅 제공 업체가 '128M'보다 매우 낮게 설정했을 수 있습니다. 위에서 언급 한 코드를 작성하고 PHP 메모리 소비에 할당 된 금액을 확인하십시오. – Perumal

관련 문제