简体   繁体   English

服务器当前无法处理此请求

[英]Server is currently unable to handle this request

I am facing a problem, don't know either this is the server problem or in my coding. 我遇到了一个问题,不知道这是服务器问题还是我的编码中的问题。 The problem is that when i make some changes(insert, update, delete) in database along with uploading images i get an error say [sitename] is currently unable to handle this request. 问题是,当我在数据库中进行一些更改(插入,更新,删除)并上传图像时,出现错误,提示[站点名称]当前无法处理此请求。 But if i make any transaction without image uploading everything goes fine. 但是,如果我没有上传图片就进行交易,一切都会很好。

But there is another thing because of that i am confused is that my site has an admin panel also, if i upload images and data from user end every thing works but if i upload the data along with images gives an error. 但是还有另一件事,因为我感到困惑,我的网站也有一个管理面板,如果我从用户端上传图像和数据,则一切正常,但是如果我将数据与图像一起上传,则会出现错误。 Don't know where the problem is. 不知道问题出在哪里。 Either it is at server side problem or in my code.? 是服务器端问题还是我的代码中?

Following is the code that is being used at user end. 以下是在用户端使用的代码。

 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
            }
        } 
    }

And here is the code which is being used at backend, both are almost same. 这是后端使用的代码,两者几乎相同。

        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.';
                    }
                }
            }
        }
    }

And here is the server error 这是服务器错误

Server Error Image 服务器错误图片

And Here are the server log errors 这是服务器日志错误

Log Errors 记录错误

Based on the error log, it looks like your server resource cannot handle your request anymore. 根据错误日志,您的服务器资源似乎无法再处理您的请求。

If physical memory for PHP is not enough to process your script then your web server cannot spawn new child process, thereby HTTP 500 error is encountered. 如果PHP的物理内存不足以处理您的脚本,则您的Web服务器无法生成新的子进程,从而遇到HTTP 500错误。

Here, you need to look over your physical memory if you're using physical server. 在这里,如果您使用的是物理服务器,则需要查看物理内存。 If you're running in VM, try allocating more memory to VM. 如果您在VM中运行,请尝试为VM分配更多的内存。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM