服务器当前无法处理此请求
我面临一个问题,不知道这是服务器问题还是我的编码。问题是,当我在数据库中进行一些更改(插入,更新,删除)以及上传图像时,我得到一个错误,说[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.';
}
}
}
}
}
这里是服务器错误
,这里是服务器日志错误
基于错误日志,它看起来像你的服务器资源无法处理您的请求了。
如果PHP的物理内存不足以处理您的脚本,那么您的Web服务器无法产生新的子进程,从而遇到HTTP 500错误。
在这里,如果您使用物理服务器,则需要查看物理内存。如果您正在VM中运行,请尝试为VM分配更多内存。
他使用共享主机。除非他联系共享主机服务的管理员,否则他不能增加VM的物理内存。 – Perumal
我检查了我的内存使用情况,并向我展示了可用1.4 GB的0%使用情况,这意味着不存在内存使用问题。 –
这不是关于分配给虚拟机的内存限制。这是关于分配给PHP的内存限制。做一件事。要知道分配给PHP的内存有多少,请编写'echo ini_get('memory_limit');'并检查页面上打印的内容。一些共享的网络托管服务提供商设置PHP的内存限制低于实际的'128M'。在你的情况,你的虚拟主机提供商可能已经把它设置得比'128M'低。编写上面提到的代码,并检查它们分配给PHP内存消耗的分配量。 – Perumal
似乎有一些内存限制问题和PHP的内存消耗超过它分配给。看看这个链接。 http://stackoverflow.com/questions/19508313/memory-limit-1024m-still-cannot-allocate-memory-couldnt-create-child-proce。 – Perumal
什么类型的内存磁盘存储还是什么? –
我可以检查它在哪个点上占用大量内存 –