簡體   English   中英

PHP文件的權限問題

[英]Permission issue with PHP file

我正在使用CMS。 當我放置HTML代碼時,它可以工作,當我放置諸如“ hello World”之類的簡單PHP代碼時,或者當我嘗試連接到數據庫時,它都可以工作。 但是當我放置更復雜的PHP代碼(例如“ phpinfo()”)或任何SQL語句(例如"$reponse = $bdd->query('SELECT * FROM insription_14juin');" 它不起作用。 我使用提琴手得到的消息是

 403 Forbidden
 You don't have permission to access /admin/modules/gestion_articles/updateContenu.php
on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

經過多次測試,我認為JavaScript文件正在嘗試將信息加載到PHP文件中,並且顯然,當PHP代碼復雜時,JavaScript文件無權訪問該PHP文件。

這是JavaScript文件:

  $(function() {
$('#savemodif').click(function() {
    $('#formModif').append('<img src="images/ajax-loader.gif" alt="Enregistrement en cours..." id="loadingImg" />');

            var contenu ="";
    var type = $('#type').val();
    if(type == '0')
    {
                tinyMCE.triggerSave();
                contenu = $('#contenu').val();
                contenu = encodeURIComponent(contenu);
    }
    else
    {
                contenu = $('#contenu').val();
                contenu = encodeURIComponent(contenu);
    }

    /* Récupération d'infos nécessaires à la mise à jour */
    var id = $('#idcontenu').val();
    var oldtitre = $('#oldtitre').val();

    /* Récupération des mises à jours */
    var titre = $('#titre').val();
    var date = $('#date').val();
    var publie = 0; if($('#publie').is(':checked')) publie = 1;
            var diapo = '0'; if($('#diapo').is(':checked')) diapo = '1';
    var prive = 0; if($('#prive').is(':checked')) prive = 1;

    $.ajax({
        url: 'modules/gestion_articles/updateContenu_test.php',
        type: 'POST',
        data: 'id='+encodeURIComponent(id)
            + '&oldtitre='+encodeURIComponent(oldtitre)
            + '&titre='+encodeURIComponent(titre)
            + '&date='+encodeURIComponent(date)
            + '&contenu='+contenu
            + '&publie='+encodeURIComponent(publie)
            + '&diapo='+encodeURIComponent(diapo)
                            + '&prive='+encodeURIComponent(prive),

        success: function(result) {
            $('#result').html(result);
            $('#loadingImg').fadeOut(1000, function() {
                $(this).remove();
            });
        }
    });

    $('#oldtitre').attr('value',titre);

    return false;
});
  });

我已經嘗試過更改cpanel中的權限,但是它不起作用。 我重命名了每個htaccess文件,它不起作用。

任何幫助,將不勝感激。

問題終於解決了,它與modsecurity有關。 技術人員告訴我,modsecurity受到限制。 如果您遇到同樣的問題,請與您的提供者聯系。

我上面發布的代碼現在可以完美運行了。

您的問題是文件系統的權限。 我假設您不是服務器管理員。

向您的服務器管理員發送電子郵件,說明發生了什么事,他將對其進行調查並更改權限。

這是黑暗中的鏡頭,但是只要頁面的服務器文件夾中缺少占位符文件,我的cms上都會遇到類似的消息。 就像index.php之類的。

另一件事可能是添加

async: false,

到您的ajax調用,以確保它使用適當的數據運行。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM