Octavia
Octavia

Reputation: 43

Ajax load PHP $HTTP_RAW_POST_DATA is deprecated

When using Ajax load PHP function, I get this error in server error log, although it works without problems.

AH01215: PHP Deprecated:  Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in Unknown on line 0: /usr/local/cpanel/cgi-sys/ea-php56

function

$(window).load(function() {
    $.ajax({
        url: '/js/js.php',
        type:'POST',
        cache: false,
        success: function(data){
            if(data){
                $('body').append(data);
            }
        }
    }); 
})

php.ini

; As of 4.0b4, PHP always outputs a character encoding by default in
; the Content-type: header.  To disable sending of the charset, simply
; set it to be empty.
;
; PHP's built-in default is text/html
default_mimetype = "text/html"
;default_charset = "iso-8859-1"

; Always populate the $HTTP_RAW_POST_DATA variable.
;always_populate_raw_post_data = On

How can I stop this error?

Upvotes: 1

Views: 1103

Answers (1)

Octavia
Octavia

Reputation: 43

The problem is solved after change Post to GET

$(window).load(function() {
    $.ajax({
        url: '/js/js.php',
        type:'GET',
        cache: false,
        success: function(data){
            if(data){
                $('body').append(data);
            }
        }
    }); 
})

Upvotes: 3

Related Questions