自定义购物车上的间歇性服务不可用错误

时间:2015-02-20 05:32:51

标签: php apache http-status-code-503

我正在构建一个购物车,现在我正在研究产品的类别系统。我必须从管理面板添加类别才能正常工作。

现在,当我想更新类别时,页面会继续加载,3-4分钟后,它会显示mozilla firefox中的service temporarily unavailable error和chrome中的404 error

与托管服务提供商联系时,以下是他在邮件中发送的内容:

The issue that you are facing is mainly due to saturation of the number of fcgi processes allocated for your account. We allow 3 child process and for each child process, 256 worker processes. Once that limit is breached, you see that kind of error. However, those errors are auto-fixed once the number of processes reduce.

--
[Thu Feb 19 08:29:30 2015] [warn] [client My-IP-Address] mod_fcgid: can't apply process slot for /usr/local/cpanel/cgi-sys/php-fcgi, referer: http://www.example.com/nbs/Administrators/Categories/
[Thu Feb 19 08:29:31 2015] [warn] [client My-IP-Address] mod_fcgid: can't apply process slot for /usr/local/cpanel/cgi-sys/php-fcgi, referer: http://www.example.com/nbs/Administrators/Categories/
[Thu Feb 19 08:29:32 2015] [warn] [client My-IP-Address] mod_fcgid: can't apply process slot for /usr/local/cpanel/cgi-sys/php-fcgi, referer: http://www.example.com/nbs/Administrators/Categories/
[Thu Feb 19 08:29:32 2015] [warn] [client My-IP-Address] mod_fcgid: can't apply process slot for /usr/local/cpanel/cgi-sys/php-fcgi, referer: http://www.example.com/nbs/Administrators/Categories/
[Thu Feb 19 08:29:32 2015] [warn] [client My-IP-Address] mod_fcgid: can't apply process slot for /usr/local/cpanel/cgi-sys/php-fcgi, referer: http://www.example.com/nbs/Administrators/Categories/
[Thu Feb 19 08:29:33 2015] [warn] [client My-IP-Address] mod_fcgid: can't apply process slot for /usr/local/cpanel/cgi-sys/php-fcgi, referer: http://www.example.com/nbs/Administrators/Categories/
[Thu Feb 19 08:29:33 2015] [warn] [client My-IP-Address] mod_fcgid: can't apply process slot for /usr/local/cpanel/cgi-sys/php-fcgi, referer: http://www.example.com/nbs/Administrators/Categories/
[Thu Feb 19 08:29:33 2015] [warn] [client My-IP-Address] mod_fcgid: can't apply process slot for /usr/local/cpanel/cgi-sys/php-fcgi, referer: http://www.example.com/nbs/Administrators/Categories/
--

In order to fix the issue permanently, you need to optimize your codes or please go for VPS packages.

这里是类别文件夹的php代码index.php页面

<form method="POST" action="http://www.example.com/nbs/ActionFiles/DeleteSelectedCategories.php">   
    <div class="table-responsive">
        <table border="1" class="table table-bordered table-striped">
            <thead>
                <tr>
                    <th class="text-center"><input type="checkbox" id="all" name="deleteCat[]"></th>
                    <th class="text-center">Category-Name</th>
                    <th class="text-center">Action</th>
                </tr>
                <tr>
                    <th>&nbsp;</th>
                    <th>
                        <input class="filter form-control input-sm" name="Cat-Name" placeholder="Cat-Name" data-col="Category-Name">
                    </th>
                    <th>&nbsp;</th>
                </tr>
            </thead>
            <tbody>

                <?php
                require_once '../../Classes/class.Validation.php';
                $validate = new Validation();
                $qu = "SELECT CatId, CatName FROM categories";
                $validate->Query($qu);
                if ($validate->NumRows()) {
                    while ( $row = $validate->FetchAllDatas() ) {
                        echo '<tr>
                        <td class="text-center"><input type="checkbox" id="'.$row["CatId"].'" value="'.$row["CatId"].'" name="deleteCat[]"></td>
                        <td>'.$row['CatName'].'</td>
                        <td>
                            <a href="http://www.example.com/nbs/Administrators/Categories/UpdateCategory.php?id='.$row["CatId"].'">UPDATE</a><br /><a href="http://www.example.com/nbs/ActionFiles/DeleteCategory.php?id='.$row["CatId"].'">DELETE</a>
                        </td></tr>';
                    }
                }
                ?>                          
            </tbody>
            <tfoot>
                <th class="text-center"><input type="checkbox" id="all" name="deleteCat[]"></th>
                <th class="text-center">Category-Name</th>
                <th class="text-center">Action</th>
            </tfoot>
        </table>
    </div>
    <input type="submit" id="del" name="btnCatDelete" value="DELETE" class="btn btn-link pull-right">
</form>

请告诉我我在哪里弄错了。提前谢谢。

编辑1 :UpdateCategory.php

<?php
session_start();
if (!isset($_SESSION['Administrator']) && $_SESSION['Administrator'] == "") {
    header("Location: http://www.example.com/nbs/Administrators/");
    exit();
}
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="description" content="">
    <meta name="keywords" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <title>Benefit Sqaure Administrator - Add Products</title>

    <link href="http://www.example.com/nbs/BootStrap/css/bootstrap.min.css" type="text/css" rel="stylesheet" />
    <link href="http://www.example.com/nbs/StyleSheets/toastr.css" type="text/css" rel="stylesheet" />
    <link href="http://www.example.com/nbs/StyleSheets/styles.css" type="text/css" rel="stylesheet" />
    <link href="http://www.example.com/nbs/Images/bs-favicon.png" rel="icon" type="image/x-icon" />

    <script src="http://www.example.com/nbs/JavaScripts/Modernizr.js"></script>
</head>
<body style="margin-top: 75px;">
    <?php
    require_once '../../PHP_Includes/AdminNavs.php';

    require_once '../../Classes/class.Validation.php';
    $validate = new Validation();

    $catName = $catAvail = $catDesc = $catParent = "";
    $catSeoUrl = $catMetaTitle = $catMetaDesc = $catMetaKeyWords = "";
    $catTaxPercent = "";
    $error = 0;

    if (isset($_GET['id']) && $_GET['id'] != "") {
        $q = "SELECT * FROM categories WHERE CatId = '".$_GET['id']."' ";
        $validate->Query($q);
        if ($validate->NumRows()) {
            while ($row = $validate->FetchAllDatas()) {
                $catName = $row['CatName'];
                $catDesc = $row['CatDescription'];
                $catParent = $row['CatParentId'];
                $catAvail = $row['CatDisplay'];

                $catSeoUrl = $row['CatSeoUrl'];
                $catMetaTitle = $row['CatMetaTitle'];
                $catMetaDesc = $row['CatMetaDescription'];
                $catMetaKeyWords = $row['CatMetaKeyWords'];

                $catTaxPercent = $row['CatTaxPercent'];
            }
        }
    }
    ?>

    <div class="container-fluid">
        <div class="tabbable">
            <ul class="nav nav-tabs">
                <li class="active">
                    <a href="#general" data-toggle="tab">General</a>
                </li>               
                <li>
                    <a href="#marketing" data-toggle="tab">Marketing</a>
                </li>
                <li>
                    <a href="#account" data-toggle="tab">Accounts</a>
                </li>
            </ul>
            <div class="tab-content" style="margin-top: 25px;">
                <div class="container-fluid tab-pane active" id="general">
                    <div class="panel panel-primary">
                        <div class="panel-heading">
                            <h4 class="text-center">Update Product Details</h4>
                        </div>
                        <div class="panel-body">
                            <form class="form-horizontal" action="http://www.example.com/nbs/ActionFiles/UpdateCategories.php?id=<?php echo $_GET['id']; ?>" method="POST">

                                <div class="form-group">
                                    <div class="col-md-2">
                                        <label id="prodName" for="productName">Category Name:</label>
                                    </div>
                                    <div class="col-md-8">
                                        <input type="text" name="updCatName" value="<?php echo $catName; ?>" class="form-control input-sm" id="productName" />
                                    </div>
                                    <div class="col-md-2">
                                        <span class="glyphicon glyphicon-question-sign" style="margin-top: 5px;" data-toggle="tooltip" data-placement="right" title="The name of the category that you want to be displayed. It should contain only letters"></span>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <div class="col-md-2">
                                        <label id="prodAvail" for="productAvailability">Parent Category:</label>
                                    </div>
                                    <div class="col-md-8">
                                        <select name="updCatParent" class="form-control input-sm" id="productAvailability">
                                            <?php
                                            $name = "";
                                            $query = "SELECT CatName, CatParentId FROM categories WHERE CatParentId = '".$catParent."'";
                                            $validate->Query($query);
                                            while ($row = $validate->FetchAllDatas()) {
                                                if ($row['CatParentId'] == 0) {
                                                    $name = "Parent Category";
                                                } else {
                                                    $que = "SELECT c.CatName, cn.CatParentId FROM categories c, categories cn WHERE cn.CatParentId = c.CatId AND cn.CatParentId = '".$catParent."'";
                                                    $validate->Query($que);
                                                    $name = $validate->FetchAssoc('CatName');
                                                }
                                            }



                                            ?>
                                            <option value="<?php echo $catParent; ?>"><?php echo $name . " -- selected"; ?></option>
                                            <?php
                                            $query = "SELECT CatId, CatName FROM categories ORDER BY CatName";
                                            $validate->Query($query);
                                            while ($row = $validate->FetchAllDatas()) {
                                                echo '<option value="'.$row['CatId'].'">'.$row['CatName'].'</option>';
                                            }
                                            ?>
                                        </select>
                                    </div>
                                    <div class="col-md-2">
                                        <span class="glyphicon glyphicon-question-sign" style="margin-top: 5px;" data-toggle="tooltip" data-placement="right" title="The availability of the category for the users"></span>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <div class="col-md-2">
                                        <label id="prodAvail" for="productAvailability">Category Availability:</label>
                                    </div>
                                    <div class="col-md-8">
                                        <select name="updCatAvail" class="form-control input-sm" id="productAvailability">
                                            <option value="<?php echo $catAvail; ?>"><?php echo $catAvail . " -- selected"; ?></option>
                                            <option value="-1">Select Category Availability</option>
                                            <option value="Enabled">Enabled</option>
                                            <option value="Disabled">Disabled</option>
                                        </select>
                                    </div>
                                    <div class="col-md-2">
                                        <span class="glyphicon glyphicon-question-sign" style="margin-top: 5px;" data-toggle="tooltip" data-placement="right" title="The availability of the category for the users"></span>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <div class="col-md-2">
                                        <label for="productDes">Category Description</label>
                                    </div>
                                    <div class="col-md-8">
                                        <textarea name="catDescription" id="productDes"><?php echo $catDesc; ?></textarea>
                                    </div>
                                    <div class="col-md-2">
                                        <span class="glyphicon glyphicon-question-sign" style="margin-top: 5px;" data-toggle="tooltip" data-placement="right" title="The description of the category for the users"></span>
                                    </div>
                                </div>

                                <div class="form-group">
                                    <div class="col-md-2"></div>
                                    <div class="col-md-8">
                                        <input type="submit" name="btnUpdGenTabCate" id="btnUpdGenTabCate" value="Update Product" class="form-control input-lg btn btn-block btn-primary prdBtnSubmit">
                                    </div>
                                    <div class="col-md-2"></div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>

                <div class="container-fluid tab-pane" id="marketing" style="margin-top: 25px;">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <h4 class="text-center">Enter Marketing Details</h4>
                        </div>
                        <div class="panel-body">
                            <form class="form-horizontal" action="http://www.example.com/nbs/ActionFiles/UpdateCategoriesMkt.php?id=<?php echo $_GET['id']; ?>" method="POST" >
                                <div class="form-group">
                                    <div class="col-md-2">
                                        <label for="seoURL">SEO URL:</label>
                                    </div>
                                    <div class="col-md-8">
                                        <input type="text" name="catSeoUrl" id="seoURL" class="form-control input-sm" value="<?php echo $catSeoUrl; ?>" />
                                    </div>
                                    <div class="col-md-2"></div>
                                </div>

                                <div class="form-group">
                                    <div class="col-md-2">
                                        <label for="metTitle">Meta Title:</label>
                                    </div>
                                    <div class="col-md-8">
                                        <input type="text" name="catMetaTitle" id="metTitle" class="form-control input-sm"  value="<?php echo $catMetaTitle; ?>"/>
                                    </div>
                                    <div class="col-md-2"></div>
                                </div>

                                <div class="form-group">
                                    <div class="col-md-2">
                                        <label for="metDesc">Meta Description:</label>
                                    </div>
                                    <div class="col-md-8">
                                        <textarea name="catMetaDescription" id="metDesc" class="form-control input-sm" ><?php echo $catMetaDesc; ?></textarea>
                                    </div>
                                    <div class="col-md-2"></div>
                                </div>

                                <div class="form-group">
                                    <div class="col-md-2">
                                        <label for="metKeyWords">Meta Keywords:</label>
                                    </div>
                                    <div class="col-md-8">
                                        <input type="text" name="catMetaKeyWords" id="metKeyWords" class="form-control input-sm" value="<?php echo $catMetaKeyWords; ?>" />
                                    </div>
                                    <div class="col-md-2"></div>
                                </div>

                                <div class="form-group">
                                    <div class="col-md-2"></div>
                                    <div class="col-md-8">
                                        <input type="submit" name="btnCatMrktgTabUpdate" value="Update Marketing" class="btn btn-primary btn-block">
                                    </div>
                                    <div class="col-md-2"></div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>

                <div class="container-fluid tab-pane" id="account" style="margin-top: 25px;">
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <h4 class="text-center">Enter Commission Details</h4>
                        </div>
                        <div class="panel-body">
                            <form method="POST" class="form-horizontal" action="http://www.example.com/nbs/ActionFiles/UpdateCategoriesTax.php?id=<?php echo $_GET['id']; ?>" >
                                <div class="form-group">
                                    <div class="col-md-2">
                                        <label for="modCommission">Tax Percentage:</label>
                                    </div>
                                    <div class="col-md-8">
                                        <input type="text" name="catTaxPercent" id="modCommission" class="form-control input-sm" value="<?php echo $catTaxPercent; ?>" />
                                    </div>
                                    <div class="col-md-2"></div>
                                </div>

                                <div class="form-group">
                                    <div class="col-md-2"></div>
                                    <div class="col-md-8">
                                        <input type="submit" name="btnUCommTabUpdate" value="Update Commission" class="btn btn-primary btn-block">
                                    </div>
                                    <div class="col-md-2"></div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- Include all the JavaScript File(s) -->
    <script src="http://www.example.com/nbs/JavaScripts/jquery-latest.min.js"></script>
    <script src="http://www.example.com/nbs/JavaScripts/toastr.min.js"></script>
    <script src="http://www.example.com/nbs/JavaScripts/Main.js"></script>
    <script src="http://www.example.com/nbs/JavaScripts/multifilter.min.js"></script>
    <script src="http://www.example.com/nbs/BootStrap/js/bootstrap.min.js"></script>
    <script src="http://www.example.com/nbs/ckeditor/ckeditor.js"></script>
    <script type="text/javascript">
        CKEDITOR.replace('productDes');
    </script>
</body>
</html>

1 个答案:

答案 0 :(得分:0)

好吧,当托管公司设置对服务器上的资源的硬限制时会发生这种情况。在这种情况下,您需要更改您的托管服务提供商。

无论如何,您的查询返回了多少行?