我面臨一個問題,不知道這是服務器問題還是我的編碼。問題是,當我在數據庫中進行一些更改(插入,更新,刪除)以及上傳圖像時,我得到一個錯誤,說[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的內存消耗超過它分配給。看看這個鏈接。 http://stackoverflow.com/questions/19508313/memory-limit-1024m-still-cannot-allocate-memory-couldnt-create-child-proce。 – Perumal
什麼類型的內存磁盤存儲還是什麼? –
我可以檢查它在哪個點上佔用大量內存 –