2016-12-17 26 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の物理メモリでスクリプトを処理できない場合、Webサーバーは新しい子プロセスを生成できないため、HTTP 500エラーが発生します。

ここで、物理サーバーを使用している場合は、物理メモリを確認する必要があります。 VMで実行している場合は、VMにさらに多くのメモリを割り当ててみてください。

+0

彼は共有ホスティングを使用しています。彼は、共有ホスティングサービスの管理者に連絡するまで、物理メモリをVMに増やすことはできません。 – Perumal

+0

私は自分のメモリ使用量をチェックしました。利用可能な1.4GBの0%の使用量を示しています。これは、メモリ使用量に問題がないことを意味します。 –

+0

あなたのVMに割り当てられているメモリの上限ではありません。これは、PHPに割り当てられるメモリの上限です。一つのことをしてください。どのくらいのメモリがPHPに割り当てられているか知るには、 'echo ini_get( 'memory_limit');を実行し、ページに表示されているものをチェックしてください。一部の共有Webホスティングサービスプロバイダは、PHPのメモリ制限を実際の128Mより低く設定します。あなたのケースでは、あなたのウェブホスティングプロバイダは、それが '128Mよりも非常に低く設定されているかもしれません。上記のコードを書いて、PHPのメモリ消費量にどれくらい割り当てられているか調べてください。 – Perumal

関連する問題